fix: 路由父级的记录改为全局 修复点击选项卡X无法跳转到正确来源的bug

This commit is contained in:
gaoyunqi
2024-04-25 10:43:33 +08:00
parent d6cdb7ee26
commit b58e013957
6 changed files with 15 additions and 13 deletions

View File

@ -38,9 +38,12 @@ function createPageGuard(router: Router) {
// Notify routing changes
setRouteChange(to);
const toPath = to.path;
if (toPath.indexOf('views/secondDev') >= 0 || toPath.indexOf('/viewForm') >= 0) {
if (/createFlow|approveFlow|createForm|viewForm/.test(toPath)) {
// 记录从哪里来的 关闭页面的时候好跳回去
localStorage.setItem('parentRoutePath', from.path);
if(!window.fcd.routeBackMapping[to.path]){
// tab切换也会触发路由守卫 所以只记录第一次的状态
window.fcd.routeBackMapping[to.path] = from.path;
}
}
return true;
});