index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Component({
  2. data: {
  3. selected: 0,
  4. color: "#412A12",
  5. selectedColor: "#B1967B",
  6. borderStyle: "black",
  7. backgroundColor: "#ffffff",
  8. list: [{
  9. "pagePath": "/pages/index/index",
  10. "iconPath": "/imgs/icon_home_normal.png",
  11. "selectedIconPath": "/imgs/icon_home_active.png",
  12. "text": "首页"
  13. },
  14. {
  15. "pagePath": "/pages/exhibition/index",
  16. "iconPath": "/imgs/icon_exhibition_normal.png",
  17. "selectedIconPath": "/imgs/icon_exhibition_active.png",
  18. "text": "展览"
  19. },
  20. {
  21. "pagePath": "/pages/collection/index",
  22. "iconPath": "/imgs/icon_culture_normal.png",
  23. "selectedIconPath": "/imgs/icon_culture_active.png",
  24. "text": "典藏"
  25. },
  26. {
  27. "pagePath": "/pages/user/index",
  28. "iconPath": "/imgs/icon_user_normal.png",
  29. "selectedIconPath": "/imgs/icon_user_active.png",
  30. "text": "我的"
  31. }]
  32. },
  33. attached() {
  34. },
  35. methods: {
  36. switchTab(e) {
  37. const data = e.currentTarget.dataset
  38. const url = data.path
  39. wx.switchTab({url})
  40. this.setData({
  41. selected: data.index
  42. })
  43. }
  44. }
  45. })