tanzhongheY/custom-tab-bar/index.js

41 lines
913 B
JavaScript
Raw Normal View History

2021-09-01 07:52:30 +00:00
Component({
data: {
selected: 0,
color: "#7A7E83",
selectedColor: "#4bb547",
list: [{
pagePath: "/pages/index/index",
iconPath: "/img/nav/menu.png",
selectedIconPath: "/img/nav/menuIndex.png",
text: "碳知道"
},
{
pagePath: "/pages/user/user",
iconPath: "/img/nav/user.png",
selectedIconPath: "/img/nav/userIndex.png",
text: "我的"
},
{
pagePath: "/pages/new-page/index",
iconPath: "/img/nav/tzh_default.png",
selectedIconPath: "/img/nav/content.png",
text: "碳中和"
},
]
},
attached() {
},
methods: {
switchTab(e) {
// console.log(e)
const data = e.currentTarget.dataset
const url = data.path
wx.switchTab({url}) //可能是改变样式的原因
},
gotPageNew(){
wx.switchTab({
url: '/pages/new-page/index'
});
}
},
})