1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- Component({
- /**
- * 组件的属性列表
- */
- properties: {},
- /**
- * 组件的初始数据
- */
- data: {
- active: 'pages/home/home',
- list: [
- {
- 'pagePath': 'pages/home/home',
- 'text': '首页',
- 'iconPath': 'image/tabBar/home_0@2x.png',
- 'selectedIconPath': 'image/tabBar/home_1@2x.png'
- },
- {
- 'pagePath': 'pages/partner/partner',
- 'text': '优秀合作社',
- 'iconPath': 'image/tabBar/home_0@2x.png',
- 'selectedIconPath': 'image/tabBar/home_1@2x.png'
- },
- {
- 'pagePath': 'pages/news/news',
- 'text': '农事天地',
- 'iconPath': 'image/tabBar/home_0@2x.png',
- 'selectedIconPath': 'image/tabBar/home_1@2x.png'
- },
- {
- 'pagePath': 'pages/mine/mine',
- 'text': '我的',
- 'iconPath': 'image/tabBar/mine_0@2x.png',
- 'selectedIconPath': 'image/tabBar/mine_1@2x.png'
- }
- ]
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onChange(e) {
- const detail = e.detail
- wx.switchTab({
- url: `/${detail}`
- })
- this.setData({
- active: detail
- })
- },
- init() {
- const page = getCurrentPages().pop()
- this.setData({
- active: `${page.route}`
- })
- }
- }
- })
|