C端小程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

75 строки
1.9 KiB

  1. let ifStoreApp = 0;
  2. Component({
  3. data: {
  4. selected: 0,
  5. "color": "#abb1be",
  6. "selectedColor": "#FD782D",
  7. "list": [
  8. {
  9. "pagePath": "/index/index",
  10. "iconPath": "../assets/images/home.png",
  11. "selectedIconPath": "../assets/images/home-a.png",
  12. "text": "首页"
  13. },
  14. {
  15. "pagePath": "/index/user",
  16. "iconPath": "../assets/images/user.png",
  17. "selectedIconPath": "../assets/images/user-a.png",
  18. "text": "我的"
  19. }
  20. ]
  21. },
  22. attached() {
  23. if (ifStoreApp==1){
  24. this.setData({
  25. list: [
  26. {
  27. "pagePath": "/index/index",
  28. "iconPath": "../assets/images/home.png",
  29. "selectedIconPath": "../assets/images/home-a.png",
  30. "text": "首页"
  31. },
  32. {
  33. "pagePath": "/index/user",
  34. "iconPath": "../assets/images/user.png",
  35. "selectedIconPath": "../assets/images/user-a.png",
  36. "text": "我的"
  37. }
  38. ]
  39. })
  40. } else if (ifStoreApp == 2) {
  41. this.setData({
  42. list: [
  43. {
  44. "pagePath": "/index/index",
  45. "iconPath": "../assets/images/home.png",
  46. "selectedIconPath": "../assets/images/home-a.png",
  47. "text": "首页"
  48. },
  49. {
  50. "pagePath": "/index/searchbar",
  51. "iconPath": "../assets/images/mendian.png",
  52. "selectedIconPath": "../assets/images/mendian-a.png",
  53. "text": "门店"
  54. },
  55. {
  56. "pagePath": "/index/user",
  57. "iconPath": "../assets/images/user.png",
  58. "selectedIconPath": "../assets/images/user-a.png",
  59. "text": "我的"
  60. }
  61. ]
  62. })
  63. }
  64. },
  65. methods: {
  66. switchTab(e) {
  67. const data = e.currentTarget.dataset;
  68. const url = data.path;
  69. wx.switchTab({url});
  70. this.setData({
  71. selected: data.index
  72. })
  73. }
  74. }
  75. })