mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
fix(projects): 修复multiTab关闭逻辑,添加关闭左边和右边的标签右键操作
This commit is contained in:
@ -110,6 +110,37 @@ const appStore = defineStore({
|
||||
router.push(activePath);
|
||||
this.setActiveMultiTab(activePath);
|
||||
},
|
||||
/** 删除左边多页签 */
|
||||
clearLeftMultiTab(fullPath: string) {
|
||||
const { routes } = this.multiTab;
|
||||
const currentIndex = routes.findIndex(route => route.fullPath === fullPath);
|
||||
const activeIndex = this.activeMultiTabIndex;
|
||||
if (currentIndex > -1) {
|
||||
const remain = [ROUTE_HOME.path, ...routes.slice(currentIndex).map(v => v.fullPath)];
|
||||
const updateRoutes = routes.filter(v => remain.includes(v.fullPath));
|
||||
this.multiTab.routes = updateRoutes;
|
||||
if (activeIndex < currentIndex) {
|
||||
const activePath = updateRoutes[updateRoutes.length - 1].fullPath;
|
||||
router.push(activePath);
|
||||
this.setActiveMultiTab(activePath);
|
||||
}
|
||||
}
|
||||
},
|
||||
/** 删除右边多页签 */
|
||||
clearRightMultiTab(fullPath: string) {
|
||||
const { routes } = this.multiTab;
|
||||
const currentIndex = routes.findIndex(route => route.fullPath === fullPath);
|
||||
const activeIndex = this.activeMultiTabIndex;
|
||||
if (currentIndex > -1) {
|
||||
const remain = [ROUTE_HOME.path, ...routes.slice(0, currentIndex + 1).map(v => v.fullPath)];
|
||||
const updateRoutes = routes.filter(v => remain.includes(v.fullPath));
|
||||
this.multiTab.routes = updateRoutes;
|
||||
if (activeIndex > currentIndex) {
|
||||
router.push(fullPath);
|
||||
this.setActiveMultiTab(fullPath);
|
||||
}
|
||||
}
|
||||
},
|
||||
/** 点击单个页签tab */
|
||||
handleClickTab(fullPath: string) {
|
||||
if (this.multiTab.activeRoute !== fullPath) {
|
||||
|
Reference in New Issue
Block a user