footTabbar.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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)" :class="{active: index == currentTabNumber}"
  5. :style="{ backgroundImage: 'url(' + (currentTab == index ? item.activePath : item.iconPath) + ')' }">
  6. </view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import {
  12. nextTick,
  13. } from "vue";
  14. export default {
  15. data() {
  16. return {
  17. tabList: [{
  18. iconPath: 'static/images/tabbar/unselect/plan-sj.png',
  19. activePath: 'static/images/tabbar/select/plan-sj.png',
  20. path: `/pages/study/index`
  21. },
  22. {
  23. iconPath: 'static/images/tabbar/unselect/xinqing-sj.png',
  24. activePath: 'static/images/tabbar/select/xinqing-sj.png',
  25. path: `/pages/zhuanti/index`
  26. },
  27. {
  28. iconPath: 'static/images/tabbar/unselect/partner-sj.png',
  29. activePath: 'static/images/tabbar/select/partner-sj.png',
  30. path: '/pages/game/index'
  31. },
  32. {
  33. iconPath: 'static/images/tabbar/unselect/my-sj.png',
  34. activePath: 'static/images/tabbar/select/my-sj.png',
  35. path: `/pages/my/index`
  36. },
  37. ],
  38. currentTab: 0,
  39. };
  40. },
  41. props: {
  42. currentTabNumber: {
  43. type: Number,
  44. },
  45. },
  46. methods: {
  47. switchTab(path, index) {
  48. },
  49. },
  50. created() {
  51. this.currentTab = this.currentTabNumber
  52. }
  53. }
  54. </script>