| | |
| | | active: 0, |
| | | list: TabMenu, |
| | | }, |
| | | |
| | | observers: { |
| | | 'active': function (newValue) { |
| | | console.log('active变化', newValue); |
| | | } |
| | | }, |
| | | methods: { |
| | | onChange(event) { |
| | | this.setData({ active: event.detail.value }); |
| | | console.log(event); |
| | | this.setData({ active: this.data.list[event.detail.value].id }); |
| | | const url = this.data.list[event.detail.value].url.startsWith('/') |
| | | ? this.data.list[event.detail.value].url |
| | | : `/${this.data.list[event.detail.value].url}` |
| | | wx.switchTab({ |
| | | url: this.data.list[event.detail.value].url.startsWith('/') |
| | | ? this.data.list[event.detail.value].url |
| | | : `/${this.data.list[event.detail.value].url}`, |
| | | url: url |
| | | }); |
| | | }, |
| | | |