// pages/component/tabBar/index.js const app = getApp(); Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { imgUrl: app.globalData.urlStatic,//图片路径 nowPage: app.globalData.nowPage,//当前tabBar btnSwitch:true,//按钮开关 }, ready:function(e){ this.setData({ btnSwitch:true, nowPage: app.globalData.nowPage }) }, /** * 组件的方法列表 */ methods: { cutPage: function(e) {//打开遮罩 let page = e.currentTarget.dataset.page; if (page == this.data.nowPage){ return; } this.data.btnSwitch = false; app.globalData.nowPage = page; if (page == '1') { wx.reLaunch({ url: '/pages/index/index' }) } else if (page == '2'){ wx.reLaunch({ url: '/pages/star/star' }) } else if (page == '3'){ // wx.showToast({ // title: '暂未开启', // icon:'none' // }) wx.reLaunch({ url: '/pages/luckyStar/luckyStar' }) // wx.reLaunch({ // url: '/pages/mountings/mountings' // }) } else if (page == '4'){ wx.reLaunch({ url: '/pages/myCenter/myCenter' }) } } } })