fix(projects): 修复多页签删除功能
This commit is contained in:
parent
248937479c
commit
99adbc5a30
@ -14,7 +14,7 @@
|
|||||||
:closable="item.name !== ROUTE_HOME.name"
|
:closable="item.name !== ROUTE_HOME.name"
|
||||||
size="large"
|
size="large"
|
||||||
@click="handleClickTab(item.fullPath)"
|
@click="handleClickTab(item.fullPath)"
|
||||||
@close="removeMultiTab(item.fullPath)"
|
@close.stop="removeMultiTab(item.fullPath)"
|
||||||
>
|
>
|
||||||
{{ item.meta?.title }}
|
{{ item.meta?.title }}
|
||||||
</n-tag>
|
</n-tag>
|
||||||
|
@ -74,12 +74,14 @@ const appStore = defineStore({
|
|||||||
},
|
},
|
||||||
/** 删除多页签的数据 */
|
/** 删除多页签的数据 */
|
||||||
removeMultiTab(fullPath: string) {
|
removeMultiTab(fullPath: string) {
|
||||||
const index = this.getIndexInTabRoutes(fullPath);
|
const isActive = this.multiTab.activeRoute === fullPath;
|
||||||
if (index > -1) {
|
|
||||||
this.multiTab.routes = this.multiTab.routes.filter(item => item.fullPath !== fullPath);
|
|
||||||
const { routes } = this.multiTab;
|
const { routes } = this.multiTab;
|
||||||
const activePath = routes[routes.length - 1].fullPath;
|
const updateRoutes = routes.filter(v => v.fullPath !== fullPath);
|
||||||
|
this.multiTab.routes = updateRoutes;
|
||||||
|
if (isActive) {
|
||||||
|
const activePath = updateRoutes[updateRoutes.length - 1].fullPath;
|
||||||
router.push(activePath);
|
router.push(activePath);
|
||||||
|
this.setActiveMultiTab(activePath);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 点击单个页签tab */
|
/** 点击单个页签tab */
|
||||||
|
Loading…
Reference in New Issue
Block a user