42 lines
956 B
JavaScript
42 lines
956 B
JavaScript
|
|
Component({
|
||
|
|
data: {
|
||
|
|
selected: 0,
|
||
|
|
color: '#999',
|
||
|
|
selectedColor: '#0082FA',
|
||
|
|
list: [
|
||
|
|
{
|
||
|
|
pagePath: 'pages/index/index',
|
||
|
|
text: '首页',
|
||
|
|
iconPath: '/static/tabbar/home_icon.png',
|
||
|
|
selectedIconPath: '/static/tabbar/home_active.png'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
pagePath: 'pages/ai/index',
|
||
|
|
text: '智能管家',
|
||
|
|
iconPath: '/static/tabbar/news_icon.png',
|
||
|
|
selectedIconPath: '/static/tabbar/news_active.png'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
pagePath: 'pages/news/index',
|
||
|
|
text: '消息',
|
||
|
|
iconPath: '/static/tabbar/news_icon.png',
|
||
|
|
selectedIconPath: '/static/tabbar/news_active.png'
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
attached() {},
|
||
|
|
methods: {
|
||
|
|
switchTab(e) {
|
||
|
|
const data = e.currentTarget.dataset
|
||
|
|
const url = data.path
|
||
|
|
console.log(data, 'data')
|
||
|
|
wx.switchTab({
|
||
|
|
url: `/${url}`
|
||
|
|
})
|
||
|
|
this.setData({
|
||
|
|
selected: data.index
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|