beforeEach是路由跳转前执行的,afterEach是路由跳转后执行的。
afterEach只有两个参数 afterEach((to,from)=>{})
例子:
router.afterEach((to,from)=>{ if(to.path === "/news"){ alert("进来news了哦"); } })
beforeEach是路由跳转前执行的,afterEach是路由跳转后执行的。
afterEach只有两个参数 afterEach((to,from)=>{})
例子:
router.afterEach((to,from)=>{ if(to.path === "/news"){ alert("进来news了哦"); } })
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。