Lou
2024-03-18 97d55d5b998dfaf4ed5e86c20fcb3fc1075d41b3
components/tabBar/tabBar.vue
@@ -1,6 +1,6 @@
<template>
   <view>
      <u-tabbar class="custom-tabbar" zIndex="100" :value="currentTab" :fixed="true" :active-color="activeColor"
      <u-tabbar class="custom-tabbar" zIndex="100" :value="current" :fixed="true" :active-color="activeColor"
         :inactive-color="inactiveColor" @change='change'>
         <u-tabbar-item v-for="(item,index) in curTabList" :icon="item.icon" :key="index" :text="item.name">
         </u-tabbar-item>
@@ -11,7 +11,7 @@
<script>
   export default {
      props: {
         currentTab: {},
         current: Number,
      },
      data() {
         return {
@@ -21,16 +21,33 @@
            curTabList: [{
                  name: '首页',
                  iconPathSelected: '',
                  iconPath: '',
                  icon: "home",
                  iconPathSelected: '/static/img/tabbar-01-selected.png',
                  iconPath: '/static/img/tabbar-01.png',
                  // icon: "home",
                  url: '/pages/home/index'
               },
               {
                  name: '圈子',
                  iconPathSelected: 'static/img/tabbar-02-selected.png',
                  iconPath: 'static/img/tabbar-02.png',
                  // icon: "home",
                  url: '/pages/home/index'
               },
               {
                  name: '驾驶舱',
                  iconPathSelected: 'static/img/tabbar-02-selected.png',
                  iconPath: 'static/img/tabbar-02.png',
                  // icon: "home",
                  url: '/pages/statistics/index'
               },
               {
                  name: '个人中心',
                  iconPathSelected: '',
                  iconPath: '',
                  icon: "account-fill",
                  iconPathSelected: '/static/img/tabbar-03-selected.png',
                  iconPath: '/static/img/tabbar-03.png',
                  // icon: "account-fill",
                  url: '/pages/user/center'
               }
            ]
@@ -62,7 +79,10 @@
      },
      methods: {
         change(e) {
            this.$emit("change", this.curTabList[e].url)
            uni.switchTab({
               url: '/' + this.curTabList[e].path
            })
            // this.$emit("change", this.curTabList[e].url)
         },
      }