update 关闭浏览器时缓存当前页面
This commit is contained in:
+7
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user