|
@@ -48,9 +48,9 @@ export const useKeepAliveStore = defineStore({
|
|
|
removeKeepAliveName(route: any) {
|
|
|
this.keepAliveName = this.keepAliveName.filter(item => item !== route.name);
|
|
|
|
|
|
- let index = this.keepAliveList.findIndex(item => item.fullPath === route.path);
|
|
|
+ let index = this.keepAliveList.findIndex(item => item.fullPath === route.fullPath);
|
|
|
if (index > -1) {
|
|
|
- if (this.closeAliveList.every(item => item.fullPath !== route.path)) {
|
|
|
+ if (this.closeAliveList.every(item => item.fullPath !== route.fullPath)) {
|
|
|
this.closeAliveList.push(this.keepAliveList[index]);
|
|
|
}
|
|
|
this.keepAliveList.splice(index, 1);
|
|
@@ -75,7 +75,7 @@ export const useKeepAliveStore = defineStore({
|
|
|
this.keepAliveName = keepAliveName;
|
|
|
},
|
|
|
async updateKeepAliveName(route: any) {
|
|
|
- this.addKeepAliveName(route);
|
|
|
+ // this.addKeepAliveName(route);
|
|
|
console.log("updateKeepAliveName route :>> ", route, this.keepAliveList);
|
|
|
this.keepAliveList.forEach((item: any) => {
|
|
|
console.log("updateKeepAliveName item :>> ", item.fullPath, route.fullPath, item.fullPath == route.fullPath);
|
|
@@ -103,6 +103,7 @@ export const useKeepAliveStore = defineStore({
|
|
|
icon: to.meta.icon as string,
|
|
|
title: to.meta.title as string,
|
|
|
path: to.fullPath,
|
|
|
+ fullPath: to.fullPath,
|
|
|
name: to.name as string,
|
|
|
close: !to.meta.isAffix
|
|
|
};
|
|
@@ -127,34 +128,7 @@ export const useKeepAliveStore = defineStore({
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- console.log("tabStore :>> ", tabStore, to);
|
|
|
- console.log("tabsParams router:>> ", tabsParams);
|
|
|
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
|
|
|
- // );
|
|
|
- console.log(
|
|
|
- 'to.fullPath.split("?")[0] != from.fullPath.split("?")[0] :>> ',
|
|
|
- to.fullPath.split("?")[0],
|
|
|
- from.fullPath.split("?")[0],
|
|
|
- to.fullPath.split("?")[0] != from.fullPath.split("?")[0]
|
|
|
- );
|
|
|
- console.log(
|
|
|
- 'tabsParams.path.indexOf("/edit?") > -1 || tabsParams.path.indexOf("/edit/") > -1 :>> ',
|
|
|
- Boolean(tabsParams.path.indexOf("/edit?") > -1 || tabsParams.path.indexOf("/edit/") > -1)
|
|
|
- );
|
|
|
- console.log(
|
|
|
- 'tabsParams.path.indexOf("/detail?") > -1 || tabsParams.path.indexOf("/detail/") > -1 :>> ',
|
|
|
- Boolean(tabsParams.path.indexOf("/detail?") > -1 || tabsParams.path.indexOf("/detail/") > -1)
|
|
|
- );
|
|
|
- // if (from.meta?.activeMenu == to.meta?.activeMenu && to.fullPath.split("?")[0] != from.fullPath.split("?")[0]) {
|
|
|
if (tabsParams.path.indexOf("/edit?") > -1 || tabsParams.path.indexOf("/edit/") > -1) {
|
|
|
let key = "/edit?";
|
|
|
let name = "";
|
|
@@ -171,18 +145,6 @@ export const useKeepAliveStore = defineStore({
|
|
|
(hasPath1 && tabsMenuList[i].path == _path) ||
|
|
|
(hasPath2 && tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0])
|
|
|
) {
|
|
|
- console.log(
|
|
|
- "computedKeepAliveName edit ====>",
|
|
|
- i,
|
|
|
- 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;
|
|
@@ -191,7 +153,10 @@ export const useKeepAliveStore = defineStore({
|
|
|
}
|
|
|
console.log("keilll name edit:>> ", name);
|
|
|
tabStore.setTabs(tabsMenuList);
|
|
|
- name && this.updateKeepAliveName(to);
|
|
|
+ isReplace && this.addKeepAliveName(to);
|
|
|
+ isReplace && this.removeKeepAliveName(from);
|
|
|
+ name && to.meta.isKeepAlive && this.updateKeepAliveName(to);
|
|
|
+ // name && this.updateKeepAliveName(to);
|
|
|
// to.meta.isKeepAlive && this.updateKeepAliveName(route);
|
|
|
} else if (tabsParams.path.indexOf("/detail?") > -1 || tabsParams.path.indexOf("/detail/") > -1) {
|
|
|
let key = "/detail?";
|
|
@@ -211,17 +176,6 @@ export const useKeepAliveStore = defineStore({
|
|
|
(tabsMenuList[i].path == from.fullPath && from.fullPath.indexOf("/copy?") > -1))) ||
|
|
|
(hasPath2 && tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0])
|
|
|
) {
|
|
|
- console.log(
|
|
|
- "computedKeepAliveName detail ====>",
|
|
|
- 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;
|
|
@@ -230,14 +184,15 @@ export const useKeepAliveStore = defineStore({
|
|
|
}
|
|
|
tabStore.setTabs(tabsMenuList);
|
|
|
console.log("keilll name detail:>> ", name);
|
|
|
- name && this.updateKeepAliveName(to);
|
|
|
+ isReplace && this.addKeepAliveName(to);
|
|
|
+ isReplace && this.removeKeepAliveName(from);
|
|
|
+ name && to.meta.isKeepAlive && this.updateKeepAliveName(to);
|
|
|
+ // name && this.updateKeepAliveName(to);
|
|
|
// to.meta.isKeepAlive && this.addKeepAliveName(to);
|
|
|
- console.log("add this.keepAliveName :>> ", this.keepAliveName);
|
|
|
}
|
|
|
// }
|
|
|
!isReplace && tabStore.addTabs(tabsParams);
|
|
|
!isReplace && to.meta.isKeepAlive && this.addKeepAliveName(to);
|
|
|
- console.log("!isReplace && to.meta.isKeepAlive => ", Boolean(!isReplace), Boolean(to.meta.isKeepAlive));
|
|
|
}
|
|
|
}
|
|
|
});
|