index.js 1023 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. Component({
  2. data: {
  3. current: 0,
  4. list: [{
  5. "pagePath": "/pages/index/index",
  6. "text": "首页",
  7. "iconPath": "/static/images/tabbar/btn_ico_home_nomal@2x.png",
  8. "selectedIconPath": "/static/images/tabbar/btn_ico_home_pressed@2x.png"
  9. },
  10. {
  11. "pagePath": "/pages/total/index",
  12. "text": "统计",
  13. "iconPath": "/static/images/tabbar/btn_ico_statistics_nomal@2x.png",
  14. "selectedIconPath": "/static/images/tabbar/btn_ico_statistics_pressed@2x.png"
  15. },
  16. {
  17. "pagePath": "/pages/mine/index",
  18. "text": "我的",
  19. "iconPath": "/static/images/tabbar/btn_ico_my_nomal@2x.png",
  20. "selectedIconPath": "/static/images/tabbar/btn_ico_my_pressed@2x.png"
  21. }
  22. ]
  23. },
  24. attached() {},
  25. methods: {
  26. tabbarChange(e) {
  27. console.log(e)
  28. const idx = e.detail.index
  29. const path = e.detail.pagePath
  30. wx.switchTab({
  31. url: path,
  32. })
  33. this.setData({
  34. current: idx
  35. })
  36. }
  37. }
  38. })