MtaTabBar.vue 1007 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <view class="dljt-tab-bar-box">
  3. <!-- active -->
  4. <view class="bar-item" v-for="(item, index) in tabList" :key="index"
  5. @click="switchTab(item)" :class="{active: activeIndex === index}">
  6. <icon :class="item.icon"></icon>
  7. <text>{{ item.text }}</text>
  8. </view>
  9. </view>
  10. </template>
  11. <script setup>
  12. const tabList = [
  13. {text: '首页',pagePath: '/pages/index/index', icon: 'sy-cion', selectedIcon: ''},
  14. {text: '校园动态',pagePath: '/pages/dqgzDangjiangongzuo/dqgzDangjiangongzuo', icon: 'xydt-cion', selectedIcon: ''},
  15. {text: '招生就业',pagePath: '/pages/zsjyZhaoshengjianzhang/zsjyZhaoshengjianzhang', icon: 'zsjy-cion', selectedIcon: ''},
  16. {text: '联系方式',pagePath: '/pages/xygkLianxifangshi/xygkLianxifangshi', icon: 'lxfs-cion', selectedIcon: ''}
  17. ]
  18. const props = defineProps({
  19. activeIndex: {
  20. type: String
  21. }
  22. })
  23. function switchTab(item) {
  24. console.log('item', item)
  25. uni.reLaunch({ url: item.pagePath });
  26. }
  27. </script>
  28. <style>
  29. </style>