From 7fe790db74fdaaf8d0d8875a74e60700de6e776e Mon Sep 17 00:00:00 2001 From: asd <374367073@qq.com> Date: Mon, 9 Dec 2019 10:59:31 +0800 Subject: [PATCH] update --- 2019/12/vue-router.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/2019/12/vue-router.md b/2019/12/vue-router.md index a0dc99b..22a0f6a 100644 --- a/2019/12/vue-router.md +++ b/2019/12/vue-router.md @@ -222,7 +222,7 @@ from 当前正要离开的页面信息 next 进行管道中的下一个钩子 如果是 next(false), 中断当前的导航 -2.路由独享的 导航守卫 +2.路由独享的 导航守卫,也可以声明 在main.js中的 routes 路由定义: const routes= [ @@ -232,3 +232,15 @@ const routes= [ ] 把 { path: "/a", component: aa },改成: + { + path: "/b", + component: bb, + beforeEnter:(to,from,next)=>{ + window.console.log("aaassjlfml;") + next() + } + // beforeEnter: (to, from, next) => { + // window.console.log("bedo"), + // next() + // } + }, \ No newline at end of file