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: "碳中和" }, { "pagePath": "pages/gproduct/gproduct", "iconPath": "/img/nav/menu.png", "selectedIconPath": "/img/nav/menuIndex.png", "text": "我要碳中和" } ], opacityNum:1 }, onload() { }, attached() { wx.setStorageSync('opacity',1); setInterval(()=>{ this.setData({ opacityNum:wx.getStorageSync('opacity') }) },100) }, 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' }); } }, })