tabBar.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="tabBar">
  3. <van-tabbar
  4. v-model="ActiveMessage"
  5. @change="tabBarChange"
  6. active-color="#0057ba"
  7. inactive-color="#222">
  8. <van-tabbar-item name="home">
  9. <span>首页</span>
  10. <template #icon>
  11. <van-icon :name="tabBarActive == 'home' ? honeselect : home" />
  12. </template>
  13. </van-tabbar-item>
  14. <!-- <van-tabbar-item name="ai" >-->
  15. <!-- <span>AI参谋</span>-->
  16. <!-- <template #icon>-->
  17. <!-- <van-icon :name="tabBarActive == 'ai' ? aiselect : ai"/>-->
  18. <!-- </template>-->
  19. <!-- </van-tabbar-item>-->
  20. <van-tabbar-item name="deviceWithin">
  21. <span>计划内</span>
  22. <template #icon>
  23. <van-icon :name="tabBarActive == 'deviceWithin' ? jihuaselect : jihua" />
  24. </template>
  25. </van-tabbar-item>
  26. <van-tabbar-item name="outsidelist">
  27. <span>计划外</span>
  28. <template #icon>
  29. <van-icon :name="tabBarActive == 'outsidelist' ? outselect : out" />
  30. </template>
  31. </van-tabbar-item>
  32. <van-tabbar-item name="MyList">
  33. <span>我的</span>
  34. <template #icon>
  35. <van-icon :name="tabBarActive == 'MyList' ? storeselect : store" />
  36. </template>
  37. </van-tabbar-item>
  38. </van-tabbar>
  39. </div>
  40. </template>
  41. <script>
  42. import home from '@/assets/Icon/home.png';
  43. import honeselect from '@/assets/Icon/hone-select.png';
  44. import jihua from '@/assets/Icon/jihua.png';
  45. import jihuaselect from '@/assets/Icon/jihuaselect.png';
  46. import out from '@/assets/Icon/out.png';
  47. import outselect from '@/assets/Icon/outselect.png';
  48. import store from '@/assets/Icon/store.png';
  49. import storeselect from '@/assets/Icon/storeselect.png';
  50. import ai from '@/assets/Icon/ai.png';
  51. import aiselect from '@/assets/Icon/aiselect.png';
  52. export default {
  53. name: 'tabBar',
  54. props: {
  55. tabBarActive: {
  56. type: String,
  57. default: 'home',
  58. },
  59. },
  60. data() {
  61. return {
  62. ai: ai,
  63. aiselect: aiselect,
  64. store: store,
  65. storeselect: storeselect,
  66. honeselect: honeselect,
  67. home: home,
  68. jihuaselect: jihuaselect,
  69. jihua: jihua,
  70. out: out,
  71. outselect: outselect,
  72. tabBarAct: this.tabBarActive,
  73. show: false,
  74. };
  75. },
  76. computed: {
  77. ActiveMessage: {
  78. get() {
  79. return (this.tabBarAct = this.tabBarActive);
  80. },
  81. set(newValue) {
  82. return newValue;
  83. },
  84. },
  85. },
  86. methods: {
  87. tabBarChange(index) {
  88. if (
  89. localStorage.getItem('loginName') == 'lihaoyang.sm' ||
  90. localStorage.getItem('loginName') == 'zhangjunyang.sm'
  91. ) {
  92. this.show = true;
  93. }
  94. this.$router.push({ name: index + '' });
  95. },
  96. },
  97. };
  98. </script>
  99. <style lang="scss">
  100. .tabBar {
  101. z-index: 9999;
  102. }
  103. </style>