custom-tab-bar.js
847 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Component({
data: {
selected: 0,
color: "#7A7E83",
selectedColor: "#FCB952",
list: [{
pagePath: "/pages/homepage/homepage",
iconPath: "/img/index.png",
selectedIconPath: "/img/indexactive.png",
text: "首页"
},
{
pagePath: "",
iconPath: "/img/kefu.png",
selectedIconPath: "/img/kefu.png",
text: "美味君"
},
{
pagePath: "/pages/usecenter/usecenter",
iconPath: "/img/person.png",
selectedIconPath: "/img/personactive.png",
text: "我的"
}]
},
properties: {
selected: {
type: Number, // 接收父组件传过来的值
value: ''
}
},
attached() {
},
methods: {
switchTab(e) {
console.log(e)
const data = e.currentTarget.dataset
const url = data.path
wx.switchTab({url})
}
}
})