fix(tag): 修复关闭左侧/右侧标签页时未删除缓存路由问题 (#66)

This commit is contained in:
Ten-K
2021-10-20 15:45:35 +08:00
committed by GitHub
parent 7724d6443e
commit 016948d852
4 changed files with 34 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ import {
createWebHashHistory,
RouteRecordNormalized
} from "vue-router";
import { RouteConfigs } from "/@/layout/types";
import { split, uniqBy } from "lodash-es";
import { i18n } from "/@/plugins/i18n";
import { openLink } from "/@/utils/link";
@@ -74,6 +75,16 @@ export const getAliveRoute = () => {
return alivePageList;
};
// 批量删除缓存路由
export const delAliveRoutes = (delAliveRouteList: Array<RouteConfigs>) => {
delAliveRouteList.forEach(route => {
usePermissionStoreHook().cacheOperate({
mode: "delete",
name: route?.name
});
});
};
// 处理缓存路由(添加、删除、刷新)
export const handleAliveRoute = (
matched: RouteRecordNormalized[],