YouthTabbar.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view>
  3. <u-tabbar v-model="myCurrent" :list="tabbarList" :before-switch="beforeSwitch" active-color="#0DBAC7">
  4. </u-tabbar>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. name: "YouthTabbar",
  10. props: {
  11. current: 0,
  12. elderStatus: false
  13. },
  14. data() {
  15. return {
  16. activeColor: "#5098FF",
  17. oldindex: this.current,
  18. myCurrent: this.current,
  19. tabbarList: [{
  20. iconPath: "home",
  21. selectedIconPath: "home-fill",
  22. text: '主页 ',
  23. pagePath2: "/pages/youth/homePage/homePage",
  24. },
  25. {
  26. iconPath: "bookmark",
  27. selectedIconPath: "bookmark-fill",
  28. text: '课程',
  29. pagePath2: "/pages/youth/course/course",
  30. },
  31. // {
  32. // iconPath: "chat",
  33. // selectedIconPath: "chat-fill",
  34. // text: '消息',
  35. // pagePath2: "/pages/parents/messageNotification/messageNotification",
  36. // count: 99,
  37. // isDot: false,
  38. // customIcon: false,
  39. // },
  40. {
  41. iconPath: "shopping-cart",
  42. selectedIconPath: "shopping-cart-fill",
  43. text: '购物车',
  44. pagePath2: "/pages/youth/course/shoppingCar",
  45. },
  46. {
  47. iconPath: "account",
  48. selectedIconPath: "account-fill",
  49. text: '我的',
  50. pagePath2: "/pages/youth/mine/mine",
  51. }
  52. ],
  53. };
  54. },
  55. methods: {
  56. setcount(c) {
  57. this.myCurrent = c
  58. },
  59. beforeSwitch(index) {
  60. if (index == this.current) {
  61. return false
  62. }
  63. var url = this.tabbarList[index].pagePath2;
  64. uni.navigateTo({
  65. url: url
  66. })
  67. if (index == 1) {
  68. this.myCurrent = this.oldindex;
  69. return false;
  70. } else {
  71. return true;
  72. }
  73. },
  74. },
  75. mounted() {
  76. },
  77. destroyed() {
  78. }
  79. }
  80. </script>
  81. <style>
  82. </style>