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