Blame view

custom-tab-bar/index.js 808 Bytes
6843e3d2   lifengge   增加首页、执行、我的页面
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
  Component({
    data: {
      selected: 0,
      color: "#9498a4",
      selectedColor: "#35dab5",
      list: [{
        pagePath: "/pages/index/index",
        iconPath: "/images/home.png",
        selectedIconPath: "/images/home_on.png",
        text: "首页"
      }, {
          pagePath: "/pages/work/work",
          iconPath: "/images/work.png",
          selectedIconPath: "/images/work_on.png",
          text: "办理"
          }, {
            pagePath: "/pages/mine/mine",
            iconPath: "/images/mine.png",
            selectedIconPath: "/images/mine_on.png",
            text: "我的"
          }]
    },
    attached() {
    },
    methods: {
      switchTab(e) {
        const data = e.currentTarget.dataset
        const url = data.path
        wx.switchTab({url})
        this.setData({
          selected: data.index
        })
      }
    }
  })