| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import { appConfig } from "../config/index";
- import { saveTradeActive } from "../services/utils";
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- options: {
- styleIsolation: 'shared'
- },
- /**
- * 组件的初始数据
- */
- data: {
- active: 0,
- color: '#4C4C4E',
- activeColor: '#407DB8',
- list: [
- {
- icon: appConfig.imgUrl+'tabbar-home',
- aicon: appConfig.imgUrl+'tabbar-home-active',
- text: '首页',
- url: '/pages/home/index'
- },
- {
- icon: appConfig.imgUrl+'tabbar-trade',
- aicon: appConfig.imgUrl+'tabbar-trade-active',
- text: '挂牌大厅',
- url: '/pages/trade/index'
- },
- {
- icon: appConfig.imgUrl+'tabbar-cycle',
- aicon: appConfig.imgUrl+'tabbar-cycle-active',
- text: '钻石圈',
- url: '/pages/circle/index'
- },
- {
- icon: appConfig.imgUrl+'tabbar-mine',
- aicon: appConfig.imgUrl+'tabbar-mine-active',
- text: '我的',
- url: '/pages/mine/index'
- }
- ]
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onChange(e: any) {
- /// 设置激活项
- this.setData({ active: e.detail })
- /// 页面跳转
- wx.switchTab({ url: this.data.list[e.detail].url })
- /// 防止抖动
- saveTradeActive(0)
- },
- init() {
- const page = getCurrentPages().pop()
- this.setData({
- active: this.data.list.findIndex(item => item.url === `/${page.route}`)
- })
- }
- }
- })
|