index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <u-tabbar v-model="current" :before-switch="beforeSwitch" :list="list" @change="change" active-color="#007aff"
  3. :height="Headers"></u-tabbar>
  4. </template>
  5. <script>
  6. import config from "@/common/config";
  7. export default {
  8. name: "myTabbar",
  9. options: {
  10. styleIsolation: "shared"
  11. },
  12. data() {
  13. return {
  14. list: [{
  15. pagePath: "/pages/index/index",
  16. iconPath: require("@/static/modIcon/home-1.png"),
  17. selectedIconPath: require("@/static/modIcon/home.png"),
  18. text: "首页",
  19. },
  20. {
  21. pagePath: "/pages/course/index",
  22. iconPath: require("@/static/modIcon/choose-1.png"),
  23. selectedIconPath: require("@/static/modIcon/choose.png"),
  24. text: "选购",
  25. },
  26. {
  27. pagePath: "/pages/learn/index",
  28. iconPath: require("@/static/modIcon/study-1.png"),
  29. selectedIconPath: require("@/static/modIcon/study.png"),
  30. text: "学习",
  31. },
  32. {
  33. pagePath: "/pages/questionBank/index",
  34. iconPath: require("@/static/modIcon/practice-1.png"),
  35. selectedIconPath: require("@/static/modIcon/practice.png"),
  36. text: "练习",
  37. },
  38. // {
  39. // pagePath: "/pages/information/index",
  40. // iconPath: config.BASE_IMG_URL + "/web/icon/nav4.png",
  41. // selectedIconPath: config.BASE_IMG_URL + "/web/icon/nav4_on.png",
  42. // text: "资料",
  43. // },
  44. {
  45. pagePath: "/pages/wd/index",
  46. iconPath: require("@/static/modIcon/my-1.png"),
  47. selectedIconPath: require("@/static/modIcon/my.png"),
  48. text: "我的",
  49. },
  50. ],
  51. current: 0,
  52. Headers: "100rpx"
  53. };
  54. },
  55. mounted() {
  56. },
  57. onShow() {},
  58. methods: {
  59. beforeSwitch(index) {
  60. return true; // 或者根据逻辑返回false
  61. },
  62. change(index) {
  63. this.current = index;
  64. // if (index === 4) {
  65. // this.toInformation();
  66. // }
  67. },
  68. toInformation() {
  69. uni.reLaunch({
  70. url: "/pages/information/index",
  71. });
  72. },
  73. },
  74. };
  75. </script>
  76. <style lang="scss">
  77. .u-tabbar {
  78. ::v-deep &__content {
  79. z-index: 10000 !important;
  80. }
  81. }
  82. </style>