index.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Component({
  2. data: {
  3. selected: 0,
  4. color: "#666",
  5. selectedColor: "#1fe4dc",
  6. backgroundColor: "#fafafa",
  7. borderStyle: "white",
  8. list: [{
  9. "pagePath": "/pages/index/index",
  10. iconPath: "../static/images/ic_menu_choice_nor.png",
  11. selectedIconPath: "../static/images/ic_menu_choice_pressed.png",
  12. "text": "首页"
  13. },
  14. {
  15. "pagePath": "/pages/catalog/catalog",
  16. iconPath: "../static/images/ic_menu_sort_nor.png",
  17. selectedIconPath: "../static/images/ic_menu_sort_pressed.png",
  18. "text": "分类"
  19. },
  20. {
  21. "pagePath": "/pages/cart/cart",
  22. iconPath: "../static/images/ic_menu_shoping_nor.png",
  23. selectedIconPath: "../static/images/ic_menu_shoping_pressed.png",
  24. "text": "购物车"
  25. },
  26. {
  27. "pagePath": "/pages/ucenter/index/index",
  28. iconPath: "../static/images/ic_menu_me_nor.png",
  29. selectedIconPath: "../static/images/ic_menu_me_pressed.png",
  30. "text": "我的"
  31. }]
  32. },
  33. attached() {
  34. },
  35. onShow(){
  36. },
  37. methods: {
  38. switchTab(e) {
  39. const data = e.currentTarget.dataset
  40. const url = data.path
  41. wx.switchTab({url})
  42. setTimeout(()=>{
  43. this.setData({
  44. selected: data.index
  45. })
  46. })
  47. }
  48. }
  49. })