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.
51 lines
1.2 KiB
51 lines
1.2 KiB
Component({
|
|
data: {
|
|
active: 0,
|
|
list: [
|
|
{
|
|
blur: '../assets/imgs/tabbar/tab1_blur.png',
|
|
focus: '../assets/imgs/tabbar/tab1_focus.png',
|
|
text: '首页',
|
|
url: '/pages/home/home'
|
|
},
|
|
{
|
|
blur: '../assets/imgs/tabbar/tab2_blur.png',
|
|
focus: '../assets/imgs/tabbar/tab2_focus.png',
|
|
text: '片场展示',
|
|
url: '/pages/setDisplay/setDisplay'
|
|
},
|
|
{
|
|
blur: '../assets/imgs/tabbar/tab3_blur.png',
|
|
focus: '../assets/imgs/tabbar/tab3_focus.png',
|
|
text: '联系我们',
|
|
url: '/pages/contactUs/contactUs'
|
|
}
|
|
],
|
|
},
|
|
|
|
attached() {
|
|
const tab = this.createSelectorQuery()
|
|
tab.select('.myTabbar').boundingClientRect((rect) => {
|
|
// console.log(rect)
|
|
wx.setStorageSync('tabHeight', rect.height)
|
|
}).exec()
|
|
},
|
|
|
|
methods: {
|
|
onChange(event) {
|
|
this.setData({ active: event.detail });
|
|
wx.switchTab({
|
|
url: this.data.list[event.detail].url
|
|
|
|
});
|
|
},
|
|
|
|
init() {
|
|
const page = getCurrentPages().pop();
|
|
this.setData({
|
|
active: this.data.list.findIndex(item => item.url === `/${page.route}`)
|
|
});
|
|
|
|
}
|
|
}
|
|
});
|
|
|