index.js 722 B

123456789101112131415161718192021222324252627282930313233
  1. Component({
  2. data: {
  3. selected: 0,
  4. color: "#999999",
  5. selectedColor: "#5674F0",
  6. list: [
  7. {
  8. pagePath: "/pages/home/index",
  9. text: "个人服务",
  10. iconPath: "/icon/tabbar/shouye_normal.png",
  11. selectedIconPath: "/icon/tabbar/shouye_selected.png"
  12. },
  13. {
  14. pagePath: "/pages/mine/mine",
  15. text: "我的",
  16. iconPath: "/icon/tabbar/wode_normal.png",
  17. selectedIconPath: "/icon/tabbar/wode_selected.png"
  18. }
  19. ]
  20. },
  21. attached() {
  22. },
  23. methods: {
  24. switchTab(e) {
  25. const data = e.currentTarget.dataset
  26. const url = data.path
  27. wx.switchTab({ url })
  28. this.setData({
  29. selected: data.index
  30. })
  31. }
  32. }
  33. })