Vue-router用法

#全局守卫
- router.beforeEach(to,from,next){}

#全局后置钩子
- router.afterEach(to,from){}

#路由独享守卫
- beforeEnter(to,from,next){}

#组件独享守卫
- beforeRouteEnter(to,from,next){}
- beforeRouteUpdate(to,from,next){} (2.2 新增)
- beforeRouteLeave(to,from){}

注:beforeRouteEnter 守卫 不能 访问 this,因为守卫在导航确认前被调用,因此即将登场的新组件还没被创建。

#拉下来
- Es6
- nuxt.js
- React.js
- Node.js

猜你喜欢

转载自www.cnblogs.com/leigepython/p/9229082.html