我已经在每个tabbar对应页面加入了这个也没用,下面是组件的js文件
Component({
data: {
selected: 0,
"color": "#868686",
"selectedColor": "#2929C7",
"list": [{
"pagePath": "/pages/index/index",
"iconPath": "/images/slices/组 780.png",
"selectedIconPath": "/images/slices/组 797.png",
"text": "监测"
},
{
"pagePath": "/pages/record/record",
"text": "记录",
"iconPath": "/images/slices/组 806.png",
"selectedIconPath": "/images/slices/reduce.png"
},
{
"pagePath": "/pages/my/my",
"text": "我的",
"iconPath": "/images/slices/组件 7 – 13.png",
"selectedIconPath": "/images/slices/组件 7 – 15.png"
}]
},
attached() {
},
methods: {
switchTab(e) {
let that = this
const data = e.currentTarget.dataset
const url = data.path
wx.switchTab({ url })
that.setData({
selected: data.index
})
console.log(data.index);
}
}
})
解决了吗?这个事情卡了一天了。。
同问