| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- // custom-tab-bar/index.ts
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- options: {
- styleIsolation: 'shared'
- },
- /**
- * 组件的初始数据
- */
- data: {
- active: 0,
- color: '#7d7e80',
- activeColor: '#55A154',
- list: [
- {
- icon: 'wap-home',
- text: '首页',
- url: '/pages/home/home'
- },
- {
- icon: 'balance-list',
- text: '钻石交易',
- url: '/pages/trade/trade'
- },
- {
- icon: 'gem',
- text: '钻石圈',
- url: '/pages/circle/circle'
- },
- {
- icon: 'manager',
- text: '我的',
- url: '/pages/mine/mine'
- }
- ]
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onChange(e) {
- wx.switchTab({
- url: this.data.list[e.detail].url
- });
- this.setData({ active: e.detail });
- },
- init() {
- const page = getCurrentPages().pop();
- this.setData({
- active: this.data.list.findIndex(item => item.url === `/${page.route}`)
- });
- }
- }
- })
|