import { getCurrentPageUrl } from '@/utils/util' const app = getApp() Component({ properties: {}, data: { imageUrl: app.globalData.imageUrl, isChild: 0, active: 0, list: [ { pagePath: '/doctor/pages/index/index', text: '基因疗法', pageName: 'BTN_HOME_NAV_CLICK', icon: 'tabbar3-1', iconActive: 'tabbar3-1-active', }, { pagePath: '/doctor/pages/knowledge/index', text: '小助手', pageName: 'BTN_ASSISTANT_NAV_CLICK', icon: 'tabbar3-3', iconActive: 'tabbar3-3-active', }, { pagePath: '/doctor/pages/my/index', text: '我的', pageName: 'BTN_MY_NAV_CLICK', icon: 'tabbar3-2', iconActive: 'tabbar3-2-active', }, ], }, observers: {}, lifetimes: { ready() { const pagePath = getCurrentPageUrl() const active = this.data.list.findIndex((item) => item.pagePath === pagePath) this.setData({ active, anyWhere: app.globalData.anyWhere, }) }, }, methods: { onChange() {}, handleNav(e) { const { index } = e.currentTarget.dataset const { list } = this.data const { pagePath, pageName } = list[index] if (pageName) { app.mpBehavior({ PageName: pageName }) } wx.reLaunch({ url: pagePath, }) }, }, })