You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
879 B
JavaScript

Component({
data: {
selected: 0,
nowPage: '',
list: [{
pagePath: '/pages/index/index',
text: '首页',
pages:['pages/index/index']
},
{
pagePath: '/pages/production/production',
text: '生产',
pages:['pages/production/production']
},
{
pagePath: '/pages/energy/energy',
text: '能源',
pages:['pages/energy/energy','pages/energyInfo/energyInfo']
},
{
pagePath: '/pages/my/my',
text: '我的',
pages:['/pages/my/my']
},
]
},
methods: {
onChange(e) {
const index = e.currentTarget.dataset.index
const url = this.data.list[index].pagePath
wx.switchTab({
url
})
}
},
onShow() {
const tabBar = this.getTabBar?.()
if (tabBar) {
console.log(tabBar);
}
}
})