Component({ data: { selected: 0, color: "#000000", selectedColor: "#FF8966", list: null, // 在 toggleCustomTabBar.js 中动态设置下面的菜单项 rawList: [ { "pagePath": "pages/index/index", "text": "首页", "iconPath": "image/icon/_home.png", "selectedIconPath": "image/icon/home.png" }, { "pagePath": "pages/residents/code", "text": "进出码", "iconPath": "image/icon/_code.png", "selectedIconPath": "image/icon/code.png" }, { "pagePath": "pages/residents/report", "text": "体温上报", "iconPath": "image/icon/_report.png", "selectedIconPath": "image/icon/report.png" }, { "pagePath": "pages/shop/shop", "text": "生活物资", "iconPath": "image/icon/_shopping.png", "selectedIconPath": "image/icon/shopping.png" }, { "pagePath": "pages/person/person", "text": "我", "iconPath": "image/icon/_person.png", "selectedIconPath": "image/icon/person.png" } ] }, onShow() { console.log("[CustomTabBar] onLoad") }, attached() { }, methods: { switchTab(e) { const data = e.currentTarget.dataset const url = '/' + data.path wx.switchTab({ url }) this.setData({ selected: data.index }) } } })