// pages/component/foot-tab.js Component({ /** * 组件的属性列表 */ properties: { value: { type: String, value: null } }, lifetimes: { created() { }, attached: function () { // 在组件实例进入页面节点树时执行 }, detached: function () { // 在组件实例被从页面节点树移除时执行 }, }, /** * 组件的初始数据 */ data: { list: [ { value: 'label_1', icon: 'home', ariaLabel: '首页' }, { value: 'label_2', icon: 'app', ariaLabel: '统计' }, { value: 'label_3', icon: 'chat', ariaLabel: '资产' }, { value: 'label_4', icon: 'user', ariaLabel: '我的' }, ], }, /** * 组件的方法列表 */ methods: { setIconData(cur){ if (cur == 'label_1'){ wx.redirectTo({ url: '../index/index' }) } if (cur == 'label_2'){ wx.redirectTo({ url: '../chart/index' }) } if (cur == 'label_3'){ wx.redirectTo({ url: '../account/index' }) } if (cur == 'label_4'){ wx.redirectTo({ url: '../myself/index' }) } }, checkLogin(){ // let userInfo = wx.getStorageSync('userInfo'); // let token = wx.getStorageSync('userToken'); // if (userInfo && token){ // return true; // }else { // return false; // } }, onChange(event) { // if (!this.checkLogin()){ // wx.redirectTo({url:"/pages/login/index"}); // } this.setIconData(event.detail.value); }, } })