12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- /**
- * 组件的初始数据
- */
- data: {
- active: 0,
- tabbarList: [{
- icon: 'home-o',
- text: '首页',
- url: '/pages/tabbarPage/Home/index'
- },
- {
- icon: 'service-o',
- text: '在线客服',
- url: '/pages/tabbarPage/ClientService/index'
- },
- {
- icon: ' ',
- text: '供需广场',
- url: '/pages/tabbarPage/Supply/index'
- },
- {
- icon: 'chat-o',
- text: '消息',
- url: '/pages/tabbarPage/Message/index'
- },
- {
- icon: 'contact',
- text: '我的',
- url: '/pages/tabbarPage/User/index'
- }
- ]
- },
- /**
- * 组件的方法列表
- */
- methods: {
- /* tabbar */
- onChange(event) {
- this.setData({
- active: event.target.dataset.index
- });
- wx.switchTab({
- url: this.data.tabbarList[event.target.dataset.index].url
- });
- },
- init() {
- const page = getCurrentPages().pop();
- this.setData({
- active: this.data.tabbarList.findIndex(item => item.url === `/${page.route}`)
- });
- },
- }
- })
|