1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /* eslint-disable */
- Component({
- data: {
- active: 0,
- list: [
- {
- icon: 'home-o',
- text: '首页',
- url: '/pages/index/main'
- },
- {
- icon: 'point-gift-o',
- text: '套餐',
- url: '/pages/bundle/main'
- },
- {
- icon: 'location-o',
- text: '门店',
- url: '/pages/store/main'
- },
- {
- icon: 'friends-o',
- text: '我的',
- url: '/pages/member/main'
- }
- ]
- },
- methods: {
- onChange(event) {
- if(event.detail === 3 && !wx.getStorageSync('token')) {
- wx.redirectTo({
- url: '/pages/login/main?lanuch=true&path=' + encodeURIComponent('/pages/member/main')
- });
- } else {
- this.setData({ active: event.detail });
- wx.switchTab({
- url: this.data.list[event.detail].url
- });
- }
-
-
- },
- init() {
- const page = getCurrentPages().pop();
- this.setData({
- active: this.data.list.findIndex(item => item.url === `/${page.route}`)
- });
- }
- }
- });
|