vue——router内容
1.hash和history模式
2.router-linl中属性:
-
replace和pushstate(可以goback())
-
每个标签单独改时在router-link中添加active-class,统一修改时,在new router中添加linkActiveClass参数
-
tag——转换成的标签,默认是a标签
-
to——路由跳转(通过点击事件,路由跳转时,在函数中设置this.$router.push())
-
传参跳转:例如:
-
:to="’/user‘+id" -
接收:
this.$router.params.id -
嵌套路由
-
-
传递参数的方式
3.全局守卫
router.beforeEach()
router.afterEach()
注:特别注意路由独享守卫和组件内的守卫