MtaTabBar.vue 823 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <view class="custom-tabbar">
  3. <view v-for="(item, index) in tabList" :key="index" @click="switchTab(item)">
  4. <image :src="activeIndex === index ? item.selectedIcon : item.icon" />
  5. <text :style="{ color: activeIndex === index ? selectedColor : defaultColor }">
  6. {{ item.text }}
  7. </text>
  8. </view>
  9. </view>
  10. </template>
  11. <script setup>
  12. const tabList = [
  13. {text: '首页',pagePath: '/pages/index/index'}, ,
  14. {text: '校园动态',pagePath: '/pages/dqgzDangjiangongzuo/dqgzDangjiangongzuo'},
  15. {text: '招生就业',pagePath: '/pages/index/index'},
  16. {text: '联系方式',pagePath: '/pages/index/index'}
  17. ]
  18. const props = defineProps({
  19. activeIndex: {
  20. type: String
  21. }
  22. })
  23. function switchTab(item) {
  24. uni.switchTab({ url: item.pagePath });
  25. }
  26. </script>
  27. <style>
  28. </style>