const app = getApp() Page({ data: { safeBottom: app.globalData.safeBottom, fHeight: app.globalData.safeFragmentHeight, tabList: [ { value: 'store', badge: 0, name: '工作台', blue: '/assets/icon/mall-blue.png', gray: '/assets/icon/mall-gray.png' }, { value: 'package', badge: 0, name: '我的', blue: '/assets/icon/home-blue.png', gray: '/assets/icon/home-gray.png' } ], tabIndex: 0, }, onLoad: function (options) { if (options.url) { var path = options.url if (options.key && options.value) { path += '?' + options.key + '=' + options.value } wx.navigateTo({ url: path }) } const fHeight = (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight) - 100 this.setData({ fHeight: fHeight, safeBottom: app.globalData.safeBottom, cityName: this.data.cityName, customHeight: app.globalData.customHeight, customWidth: app.globalData.Custom.left, StatusBar: app.globalData.StatusBar || 40, }) }, onTabClick: function(e){ if(this.data.tabIndex == e.currentTarget.dataset.index){ return } this.setData({ tabIndex: e.currentTarget.dataset.index }) this.onShow() }, stopTouchMove: function(e){ return false }, onShow: function () { var pageView = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value) if (pageView && pageView.onRestart) { pageView.onRestart() } }, })