|
@@ -58,6 +58,7 @@ import MoreButton from "./components/MoreButton.vue";
|
|
|
|
|
|
const route = useRoute();
|
|
|
const router = useRouter();
|
|
|
+console.log("router !!!!!!!!!!!!!!!!!!!!!!!!!!:>> ", router);
|
|
|
const tabStore = useTabsStore();
|
|
|
const authStore = useAuthStore();
|
|
|
const globalStore = useGlobalStore();
|
|
@@ -84,91 +85,92 @@ watch(
|
|
|
() => route.fullPath,
|
|
|
() => {
|
|
|
if (route.meta.isFull) return;
|
|
|
+
|
|
|
console.log("watch route :>> ", route);
|
|
|
tabsMenuValue.value = route.fullPath;
|
|
|
- const tabsParams = {
|
|
|
- icon: route.meta.icon as string,
|
|
|
- title: route.meta.title as string,
|
|
|
- path: route.fullPath,
|
|
|
- name: route.name as string,
|
|
|
- close: !route.meta.isAffix
|
|
|
- };
|
|
|
- console.log("tabStore :>> ", tabStore, route);
|
|
|
- console.log("tabsParams :>> ", tabsParams, route);
|
|
|
- let isReplace = false;
|
|
|
- // console.log(
|
|
|
- // 'tabsParams.path.indexOf("/edit?") > -1 , :>> ',
|
|
|
- // tabsParams.path.indexOf("/edit?") > -1,
|
|
|
- // tabsParams.path.indexOf("/edit/") > -1
|
|
|
- // );
|
|
|
- // console.log(
|
|
|
- // 'tabsParams.path.indexOf("/detail?") > -1 , :>> ',
|
|
|
- // tabsParams.path.indexOf("/detail?") > -1,
|
|
|
- // tabsParams.path.indexOf("/detail/") > -1
|
|
|
- // );
|
|
|
- if (tabsParams.path.indexOf("/edit?") > -1 || tabsParams.path.indexOf("/edit/") > -1) {
|
|
|
- let key = "/edit?";
|
|
|
- let name = "";
|
|
|
- let _path = tabsParams.path.replace(key, "/detail?");
|
|
|
- // 使用路由参数的地址,忽略查询参数后,查找相同地址
|
|
|
- let _path2 = tabsParams.path.replace("/edit/", "/detail/");
|
|
|
- let hasPath1 = route.fullPath.indexOf("/edit?") > -1;
|
|
|
- let hasPath2 = route.fullPath.indexOf("/edit/") > -1;
|
|
|
- let tabsMenuList = tabStore.tabsMenuList;
|
|
|
- for (let i = 0; i < tabsMenuList.length; i++) {
|
|
|
- if (
|
|
|
- (hasPath1 && tabsMenuList[i].path == _path) ||
|
|
|
- (hasPath2 && tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0])
|
|
|
- ) {
|
|
|
- name = tabsMenuList[i].name;
|
|
|
- tabsMenuList[i] = tabsParams;
|
|
|
- isReplace = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- console.log("keilll name edit:>> ", name);
|
|
|
- tabStore.setTabs(tabsMenuList);
|
|
|
- name && keepAliveStore.updateKeepAliveName(route);
|
|
|
- // route.meta.isKeepAlive && keepAliveStore.updateKeepAliveName(route);
|
|
|
- } else if (tabsParams.path.indexOf("/detail?") > -1 || tabsParams.path.indexOf("/detail/") > -1) {
|
|
|
- let key = "/detail?";
|
|
|
- let name = "";
|
|
|
- let _path = tabsParams.path.replace(key, "/edit?");
|
|
|
- // 使用路由参数的地址,忽略查询参数后,查找相同地址
|
|
|
- let _path2 = tabsParams.path.replace("/detail/", "/edit/");
|
|
|
- let hasPath1 = route.fullPath.indexOf("/detail?") > -1;
|
|
|
- let hasPath2 = route.fullPath.indexOf("/detail/") > -1;
|
|
|
- let tabsMenuList = tabStore.tabsMenuList;
|
|
|
- for (let i = 0; i < tabsMenuList.length; i++) {
|
|
|
- if (
|
|
|
- (hasPath1 && tabsMenuList[i].path == _path) ||
|
|
|
- (hasPath2 && tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0])
|
|
|
- ) {
|
|
|
- // console.log(
|
|
|
- // " (hasPath2 && tabsMenuList[i].path.split('?)[0] == _path2.split('?')[0])",
|
|
|
- // tabsMenuList[i].path,
|
|
|
- // _path,
|
|
|
- // tabsMenuList[i].path == _path,
|
|
|
- // hasPath2,
|
|
|
- // tabsMenuList[i].path.split("?")[0],
|
|
|
- // _path2.split("?")[0],
|
|
|
- // tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0],
|
|
|
- // tabsMenuList[i]
|
|
|
- // );
|
|
|
- name = tabsMenuList[i].name;
|
|
|
- tabsMenuList[i] = tabsParams;
|
|
|
- isReplace = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- tabStore.setTabs(tabsMenuList);
|
|
|
- console.log("keilll name detail:>> ", name);
|
|
|
- name && keepAliveStore.updateKeepAliveName(route);
|
|
|
- // route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route);
|
|
|
- console.log("add keepAliveStore.keepAliveName :>> ", keepAliveStore.keepAliveName);
|
|
|
- }
|
|
|
- !isReplace && tabStore.addTabs(tabsParams);
|
|
|
- !isReplace && route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route);
|
|
|
+ // const tabsParams = {
|
|
|
+ // icon: route.meta.icon as string,
|
|
|
+ // title: route.meta.title as string,
|
|
|
+ // path: route.fullPath,
|
|
|
+ // name: route.name as string,
|
|
|
+ // close: !route.meta.isAffix
|
|
|
+ // };
|
|
|
+ // console.log("tabStore :>> ", tabStore, route);
|
|
|
+ // console.log("tabsParams router:>> ", tabsParams, router);
|
|
|
+ // let isReplace = false;
|
|
|
+ // // console.log(
|
|
|
+ // // 'tabsParams.path.indexOf("/edit?") > -1 , :>> ',
|
|
|
+ // // tabsParams.path.indexOf("/edit?") > -1,
|
|
|
+ // // tabsParams.path.indexOf("/edit/") > -1
|
|
|
+ // // );
|
|
|
+ // // console.log(
|
|
|
+ // // 'tabsParams.path.indexOf("/detail?") > -1 , :>> ',
|
|
|
+ // // tabsParams.path.indexOf("/detail?") > -1,
|
|
|
+ // // tabsParams.path.indexOf("/detail/") > -1
|
|
|
+ // // );
|
|
|
+ // if (tabsParams.path.indexOf("/edit?") > -1 || tabsParams.path.indexOf("/edit/") > -1) {
|
|
|
+ // let key = "/edit?";
|
|
|
+ // let name = "";
|
|
|
+ // let _path = tabsParams.path.replace(key, "/detail?");
|
|
|
+ // // 使用路由参数的地址,忽略查询参数后,查找相同地址
|
|
|
+ // let _path2 = tabsParams.path.replace("/edit/", "/detail/");
|
|
|
+ // let hasPath1 = route.fullPath.indexOf("/edit?") > -1;
|
|
|
+ // let hasPath2 = route.fullPath.indexOf("/edit/") > -1;
|
|
|
+ // let tabsMenuList = tabStore.tabsMenuList;
|
|
|
+ // for (let i = 0; i < tabsMenuList.length; i++) {
|
|
|
+ // if (
|
|
|
+ // (hasPath1 && tabsMenuList[i].path == _path) ||
|
|
|
+ // (hasPath2 && tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0])
|
|
|
+ // ) {
|
|
|
+ // name = tabsMenuList[i].name;
|
|
|
+ // tabsMenuList[i] = tabsParams;
|
|
|
+ // isReplace = true;
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // console.log("keilll name edit:>> ", name);
|
|
|
+ // tabStore.setTabs(tabsMenuList);
|
|
|
+ // name && keepAliveStore.updateKeepAliveName(route);
|
|
|
+ // // route.meta.isKeepAlive && keepAliveStore.updateKeepAliveName(route);
|
|
|
+ // } else if (tabsParams.path.indexOf("/detail?") > -1 || tabsParams.path.indexOf("/detail/") > -1) {
|
|
|
+ // let key = "/detail?";
|
|
|
+ // let name = "";
|
|
|
+ // let _path = tabsParams.path.replace(key, "/edit?");
|
|
|
+ // // 使用路由参数的地址,忽略查询参数后,查找相同地址
|
|
|
+ // let _path2 = tabsParams.path.replace("/detail/", "/edit/");
|
|
|
+ // let hasPath1 = route.fullPath.indexOf("/detail?") > -1;
|
|
|
+ // let hasPath2 = route.fullPath.indexOf("/detail/") > -1;
|
|
|
+ // let tabsMenuList = tabStore.tabsMenuList;
|
|
|
+ // for (let i = 0; i < tabsMenuList.length; i++) {
|
|
|
+ // if (
|
|
|
+ // (hasPath1 && tabsMenuList[i].path == _path) ||
|
|
|
+ // (hasPath2 && tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0])
|
|
|
+ // ) {
|
|
|
+ // console.log(
|
|
|
+ // " (hasPath2 && tabsMenuList[i].path.split('?)[0] == _path2.split('?')[0])",
|
|
|
+ // tabsMenuList[i].path,
|
|
|
+ // _path,
|
|
|
+ // tabsMenuList[i].path == _path,
|
|
|
+ // hasPath2,
|
|
|
+ // tabsMenuList[i].path.split("?")[0],
|
|
|
+ // _path2.split("?")[0],
|
|
|
+ // tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0],
|
|
|
+ // tabsMenuList[i]
|
|
|
+ // );
|
|
|
+ // name = tabsMenuList[i].name;
|
|
|
+ // tabsMenuList[i] = tabsParams;
|
|
|
+ // isReplace = true;
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // tabStore.setTabs(tabsMenuList);
|
|
|
+ // console.log("keilll name detail:>> ", name);
|
|
|
+ // name && keepAliveStore.updateKeepAliveName(route);
|
|
|
+ // // route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route);
|
|
|
+ // console.log("add keepAliveStore.keepAliveName :>> ", keepAliveStore.keepAliveName);
|
|
|
+ // }
|
|
|
+ // !isReplace && tabStore.addTabs(tabsParams);
|
|
|
+ // !isReplace && route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route);
|
|
|
},
|
|
|
{ immediate: true }
|
|
|
);
|