index.js 707 B

123456789101112131415161718192021222324252627282930313233
  1. Component({
  2. data: {
  3. selected: 0,
  4. color: "#999999",
  5. selectedColor: "#03C29D",
  6. list: [
  7. {
  8. pagePath: "/page/home/index",
  9. text: "首页",
  10. iconPath: "/icon/public/shouye.png",
  11. selectedIconPath: "/icon/public/shouye_selected.png"
  12. },
  13. {
  14. pagePath: "/page/findmore/index",
  15. text: "发现",
  16. iconPath: "/icon/public/faxian_normal.png",
  17. selectedIconPath: "/icon/public/faxian.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. })