index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <u-tabbar
  3. v-model="current"
  4. :before-switch="beforeSwitch"
  5. :list="list"
  6. @change="change"
  7. ></u-tabbar>
  8. <!-- <tabbar
  9. v-model="current"
  10. :before-switch="beforeSwitch"
  11. :list="list"
  12. @change="change"
  13. ></tabbar> -->
  14. </template>
  15. <script>
  16. import tabbar from "./tabbar.vue";
  17. export default {
  18. name: "myTabbar",
  19. options: { styleIsolation: "shared" },
  20. data() {
  21. return {
  22. list: [
  23. {
  24. pagePath: "/pages/index/index",
  25. iconPath: "/../../static/nav1.png",
  26. selectedIconPath: "/../../static/nav1_on.png",
  27. text: "首页",
  28. },
  29. {
  30. pagePath: "/pages/course/index",
  31. iconPath: "/../../static/nav2.png",
  32. selectedIconPath: "/../../static/nav2_on.png",
  33. text: "选课",
  34. },
  35. {
  36. pagePath: "/pages/learn/index",
  37. iconPath: "/../../static/nav6.png",
  38. selectedIconPath: "/../../static/nav6_on.png",
  39. text: "学习",
  40. },
  41. {
  42. pagePath: "/pages/questionBank/index",
  43. iconPath: "/../../static/nav3.png",
  44. selectedIconPath: "/../../static/nav3_on.png",
  45. text: "题库",
  46. },
  47. {
  48. pagePath: "/pages/information/index",
  49. iconPath: "/../../static/nav4.png",
  50. selectedIconPath: "/../../static/nav4_on.png",
  51. text: "资料",
  52. },
  53. {
  54. pagePath: "/pages/wd/index",
  55. iconPath: "/../../static/nav5.png",
  56. selectedIconPath: "/../../static/nav5_on.png",
  57. text: "我的",
  58. },
  59. ],
  60. current: 0,
  61. };
  62. },
  63. mounted() {},
  64. methods: {
  65. beforeSwitch(index) {
  66. return true; // 或者根据逻辑返回false
  67. },
  68. change(index) {
  69. this.current = index;
  70. if (index === 4) {
  71. this.toInformation();
  72. }
  73. },
  74. toInformation() {
  75. uni.reLaunch({
  76. url: "/pages/information/index",
  77. });
  78. },
  79. },
  80. components: {
  81. tabbar,
  82. },
  83. };
  84. </script>
  85. <style lang="scss">
  86. .u-tabbar {
  87. ::v-deep &__content {
  88. z-index: 10000 !important;
  89. }
  90. }
  91. </style>