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 : storePng" />
  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 storePng 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. import store from '@/store';
  53. export default {
  54. name: 'tabBar',
  55. props: {
  56. tabBarActive: {
  57. type: String,
  58. default: 'home',
  59. },
  60. },
  61. data() {
  62. return {
  63. ai: ai,
  64. aiselect: aiselect,
  65. storePng: storePng,
  66. storeselect: storeselect,
  67. honeselect: honeselect,
  68. home: home,
  69. jihuaselect: jihuaselect,
  70. jihua: jihua,
  71. out: out,
  72. outselect: outselect,
  73. tabBarAct: this.tabBarActive,
  74. show: false,
  75. };
  76. },
  77. computed: {
  78. ActiveMessage: {
  79. get() {
  80. return (this.tabBarAct = this.tabBarActive);
  81. },
  82. set(newValue) {
  83. return newValue;
  84. },
  85. },
  86. },
  87. methods: {
  88. tabBarChange(name) {
  89. // 计划外
  90. if (name == 'outsidelist') {
  91. // 进入计划内刷新列表
  92. // store.dispatch('setDeviceOutsidePage', true);
  93. }
  94. this.$router.push({ name: name + '' });
  95. },
  96. },
  97. };
  98. </script>
  99. <style lang="scss">
  100. .tabBar {
  101. z-index: 9999;
  102. }
  103. </style>