update 关闭浏览器时缓存当前页面

This commit is contained in:
zk
2024-05-21 16:08:35 +08:00
parent 16e85fe15d
commit 8c7e4a6e91
+7 -1
View File
@@ -1,4 +1,5 @@
import { createRouter, createWebHistory, Router, RouteRecordRaw } from 'vue-router';
import { setCurrentPath } from '/@/enum/pageEnum.ts';
const routes: Array<RouteRecordRaw> = [
{
@@ -60,5 +61,10 @@ const router: Router = createRouter({
history: createWebHistory('/'),
routes: [...routes],
});
router.beforeEach((to, from, next) => {
if (to.path !== '/login' && to.path !== '/screenLogin') {
setCurrentPath(to.path);
}
next();
});
export default router;