index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. Component({
  2. data: {
  3. selected: 0,
  4. unreadMsgNum: 0,
  5. color: "rgba(0, 0, 0, 0.4)",
  6. selectedColor: "#FF5700",
  7. list: [
  8. {
  9. pagePath: "/pages/index/index",
  10. text: "首页",
  11. iconPath: "/static/tab/home_n.svg",
  12. selectedIconPath: "/static/tab/home_s.svg"
  13. },
  14. {
  15. pagePath: "/pages/beerWall/beerWall",
  16. text: "精酿",
  17. iconPath: "/static/tab/beer_n.svg",
  18. selectedIconPath: "/static/tab/beer_s.svg"
  19. },
  20. {
  21. pagePath: "/pages/circles/circles",
  22. text: "广场",
  23. iconPath: "/static/tab/qz_n.svg",
  24. selectedIconPath: "/static/tab/qz_s.svg"
  25. },
  26. {
  27. pagePath: "/pages/mine/mine",
  28. text: "我的",
  29. iconPath: "/static/tab/my_n.svg",
  30. selectedIconPath: "/static/tab/my_s.svg"
  31. },
  32. ]
  33. },
  34. attached() {
  35. },
  36. methods: {
  37. switchTab(e) {
  38. const data = e.currentTarget.dataset
  39. const url = data.path
  40. wx.switchTab({ url })
  41. this.setData({
  42. selected: data.index
  43. })
  44. }
  45. }
  46. })