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

23 lines
559 B

Component({
data: {
selected: 0,
tabs: [
{ pagePath: '/pages/main/main' },
{ pagePath: '/pages/market/market' },
{ pagePath: '/pages/cart/cart' },
{ pagePath: '/pages/messages/messages' },
{ pagePath: '/pages/profile/profile' }
]
},
methods: {
setSelected(index) {
this.setData({ selected: index });
},
onTabTap(e) {
const idx = Number(e.currentTarget.dataset.index);
const tab = this.data.tabs[idx];
if (!tab) return;
wx.switchTab({ url: tab.pagePath });
}
}
});