Bladeren bron

fix:“优化底部菜单栏选中状态”

soobin 1 jaar geleden
bovenliggende
commit
9a6b32587d
2 gewijzigde bestanden met toevoegingen van 19 en 15 verwijderingen
  1. 18 14
      src/components/NavBar.vue
  2. 1 1
      src/views/orderCenter/index.vue

+ 18 - 14
src/components/NavBar.vue

@@ -33,17 +33,17 @@
     </ul>
   </div> -->
   <!-- <div> -->
-  <van-tabbar v-model="active" active-color="#4d6add" inactive-color="#404d74">
-    <van-tabbar-item replace name="home" to="home" icon="home-o">{{ $t('navBar.homePage') }}</van-tabbar-item>
-    <van-tabbar-item replace name="device" to="device" icon="setting-o">{{ $t('navBar.deviceInformation') }}</van-tabbar-item>
-    <van-tabbar-item replace name="robotranking" to="robotranking" icon="bar-chart-o">{{ $t('navBar.machineRanking') }}</van-tabbar-item>
-    <van-tabbar-item replace name="user" to="user" icon="friends-o">{{ $t('navBar.personalCenter') }}</van-tabbar-item>
+  <van-tabbar route active-color="#4d6add" inactive-color="#404d74">
+    <van-tabbar-item replace to="/home" icon="home-o">{{ $t('navBar.homePage') }}</van-tabbar-item>
+    <van-tabbar-item replace to="/device" icon="setting-o">{{ $t('navBar.deviceInformation')}}</van-tabbar-item>
+    <van-tabbar-item replace to="/robotranking" icon="bar-chart-o">{{ $t('navBar.machineRanking')}}</van-tabbar-item>
+    <van-tabbar-item replace to="/user" icon="friends-o">{{ $t('navBar.personalCenter') }}</van-tabbar-item>
   </van-tabbar>
   <!-- </div> -->
 </template>
 
 <script>
-import { onMounted, computed, ref } from "vue";
+import { onMounted, computed } from "vue";
 import { useStore } from "vuex";
 import homeUrl from "@/assets/navbarLogo/home.png";
 import homeActiveUrl from "@/assets/navbarLogo/homeActive.png";
@@ -53,11 +53,11 @@ import rankingUrl from "@/assets/navbarLogo/ranking.png";
 import rankingActiveUrl from "@/assets/navbarLogo/rankingActive.png";
 import userUrl from "@/assets/navbarLogo/user.png";
 import userActiveUrl from "@/assets/navbarLogo/userActive.png";
-import { useRouter } from "vue-router";
+// import { useRouter } from "vue-router";
 
 export default {
   setup() {
-    const router = useRouter()
+    // const router = useRouter()
     const store = useStore();
     onMounted(() => {
       // const token = getLocal('token')
@@ -65,15 +65,19 @@ export default {
       // if (token && !['/home', '/category'].includes(path)) {
       //   store.dispatch('updateCart')
       // }
-      
+
     });
     const count = computed(() => {
       return store.state.cartCount;
     });
-    const active = ref('home');
-    router.afterEach(()=>{
-      active.value = router.currentRoute.value.name;     
-    })
+    // const active = ref('home');
+    // router.afterEach(() => {
+    //   console.log("路由1", router.currentRoute.value.name)
+    //   let currentRouteName = router.currentRoute.value.name;
+    //   if (currentRouteName === 'home' || currentRouteName === 'device' || currentRouteName === 'robotranking' || currentRouteName === 'user') {
+    //     active.value = currentRouteName;
+    //   }
+    // })
 
     return {
       count,
@@ -85,7 +89,7 @@ export default {
       rankingActiveUrl,
       userUrl,
       userActiveUrl,
-      active,
+      // active,
     };
   },
 };

+ 1 - 1
src/views/orderCenter/index.vue

@@ -500,7 +500,7 @@ export default {
       endDate: "", // 结束时间 Date
       current: 0, // 页数
       size: 15, // 页大小
-      status: "",//支付状态
+      status: 1,//支付状态
       companyType: "", // 公司平台
       machineType: "", // 设备类型
       ifForeign: "",