tanzhongheY/custom-tab-bar/index.js

49 lines
1018 B
JavaScript
Raw Normal View History

2021-09-01 07:52:30 +00:00
Component({
2021-09-17 09:40:45 +00:00
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: "碳中和"
},
{
"pagePath": "pages/gproduct/gproduct",
"iconPath": "/img/nav/menu.png",
"selectedIconPath": "/img/nav/menuIndex.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'
});
}
},
})