feat: 流程详情页打开后,关闭跳回对应的列表页

This commit is contained in:
gaoyunqi
2024-04-22 12:34:17 +08:00
parent 8b0174ddb9
commit 66669b7888
5 changed files with 22 additions and 6 deletions

View File

@ -32,12 +32,16 @@ export function setupRouterGuard(router: Router) {
function createPageGuard(router: Router) {
const loadedPageMap = new Map<string, boolean>();
router.beforeEach(async (to) => {
router.beforeEach(async (to, from) => {
// The page has already been loaded, it will be faster to open it again, you dont need to do loading and other processing
to.meta.loaded = !!loadedPageMap.get(to.path);
// Notify routing changes
setRouteChange(to);
const toPath = to.path;
if (toPath.indexOf('views/secondDev') >= 0 || toPath.indexOf('/viewForm') >= 0) {
// 记录从哪里来的 关闭页面的时候好跳回去
localStorage.setItem('parentRoutePath', from.path);
}
return true;
});