panhui 3 лет назад
Родитель
Сommit
1ad4cef122
1 измененных файлов с 13 добавлено и 9 удалено
  1. 13 9
      src/views/Index.vue

+ 13 - 9
src/views/Index.vue

@@ -10,17 +10,11 @@
             v-model="active"
             z-index="20"
             safe-area-inset-bottom
-            route
             ref="tabbar"
             class="bgBack"
+            @change="changeTab"
         >
-            <van-tabbar-item
-                replace
-                v-for="item in menus"
-                :name="item.name"
-                :to="`/${$route.params.companyId}/${item.name}`"
-                :key="item.name"
-            >
+            <van-tabbar-item replace v-for="item in menus" :name="`${item.name}`" :key="item.name">
                 <span>{{ item.title }}</span>
                 <template #icon="props">
                     <van-icon v-if="props.active" class-prefix="font_family" :name="item.preIcon" />
@@ -93,10 +87,20 @@ export default {
     name: 'index',
     data() {
         return {
-            menu: null,
             tabColor: '',
             active: 'home'
         };
+    },
+    methods: {
+        changeTab(active) {
+            console.log(active);
+            this.$router.push({
+                name: active
+            });
+        }
+    },
+    mounted() {
+        this.active = this.$route.name;
     }
 };
 </script>