custom-tabbar-admin.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="ezy-custom-tabbar">
  3. <view class="tabbar-item-box">
  4. <!-- <view class="tabbar-item" v-for="(item, index) in tabList" :key="index" @click="switchTab(item.path,index)"
  5. :style="{ backgroundImage: 'url(' + (currentTab == index ? item.activePath : item.iconPath) + ')' }">
  6. </view> -->
  7. <view class="tabbar-item" v-for="(item, index) in tabList" :key="index" @click="switchTab(item.path,index)">
  8. {{item.text}}
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import {
  15. useTabBarHistory
  16. } from '@/utils/emitEvents.js';
  17. import cacheManager from "@/utils/cacheManager.js";
  18. export default {
  19. data() {
  20. return {
  21. /* tabList: [{
  22. iconPath: 'static/images/tabbar/unselect/plan-sj.png',
  23. activePath: 'static/images/tabbar/select/plan-sj.png',
  24. path: `/pages/study/index`
  25. },
  26. {
  27. iconPath: 'static/images/tabbar/unselect/partner-sj.png',
  28. activePath: 'static/images/tabbar/select/partner-sj.png',
  29. path: '/pages/game/index'
  30. },
  31. {
  32. iconPath: 'static/images/tabbar/unselect/my-sj.png',
  33. activePath: 'static/images/tabbar/select/my-sj.png',
  34. path: `/pages/my/index`
  35. },
  36. ], */
  37. tabList: [{
  38. text: '首页',
  39. path: `/pages/study/index`
  40. },
  41. {
  42. text: '家政人员',
  43. path: '/pages/game/index'
  44. },
  45. {
  46. text: '考证人员',
  47. path: `/pages/my/index`
  48. },
  49. ],
  50. currentTab: 0,
  51. };
  52. },
  53. methods: {
  54. switchTab(path, index) {
  55. uni.redirectTo({
  56. url: path
  57. });
  58. /* uni.navigateTo({
  59. url: path,
  60. "animationType": "fade-in",
  61. "animationDuration":0
  62. }); */
  63. },
  64. },
  65. created() {
  66. this.currentTab = this.currentTabNumber
  67. }
  68. }
  69. </script>
  70. <style scoped>
  71. .tabbar-item-box {
  72. display: flex;
  73. justify-content: space-around;
  74. align-items: center;
  75. height: 60px;
  76. line-height: 60px;
  77. /* 其他样式 */
  78. }
  79. .tab-item {
  80. flex: 1;
  81. /* 样式 */
  82. }
  83. .tab-icon {
  84. /* 图标样式 */
  85. }
  86. </style>