index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Component({
  2. data: {
  3. selected: 0,
  4. color: "rgba(0, 0, 0, 0.4)",
  5. selectedColor: "#FF5700",
  6. list: [
  7. {
  8. pagePath: "/pages/index/index",
  9. text: "首页",
  10. iconPath: "/static/tab/home_n.svg",
  11. selectedIconPath: "/static/tab/home_s.svg"
  12. },
  13. {
  14. pagePath: "/pages/beerWall/beerWall",
  15. text: "精酿",
  16. iconPath: "/static/tab/beer_n.svg",
  17. selectedIconPath: "/static/tab/beer_s.svg"
  18. },
  19. {
  20. pagePath: "/pages/circles/circles",
  21. text: "广场",
  22. iconPath: "/static/tab/qz_n.svg",
  23. selectedIconPath: "/static/tab/qz_s.svg"
  24. },
  25. {
  26. pagePath: "/pages/mine/mine",
  27. text: "我的",
  28. iconPath: "/static/tab/my_n.svg",
  29. selectedIconPath: "/static/tab/my_s.svg"
  30. },
  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. })