Explorar el Código

更新 路由跳转逻辑

wzh hace 4 años
padre
commit
269d28c67a
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. 9 2
      src/main.js

+ 9 - 2
src/main.js

@@ -65,8 +65,15 @@ router.beforeEach(async (to, from, next) => {
   }
 });
 router.afterEach((to, from) => {
-  store.commit("changeTab", to.query.tabText);
-  document.title = to.query.tabText;
+  if (to.name.indexOf("digitalEmpowermentCenter") != -1) {
+    store.commit("changeTab", "数字化赋能中心");
+    document.title = to.query.tabText;
+  } else {
+    let strArr = ["运输安全管理中心", "智能交易中心", "环境中心"];
+    let boo = strArr.includes(to.query.tabText);
+    store.commit("changeTab", boo ? to.query.tabText : "运输安全管理中心");
+    document.title = boo ? to.query.tabText : "运输安全管理中心";
+  }
 });
 
 app.use(router).use(ElementPlus).use(store).mount("#app");