Vue-Router中常见的编程式导航方式

Vue-Router中常见的导航方式

this.$router.push("hash地址");

this.$router.push("/login");

this.$router.push({ name:'user' , params: {id:123} });

this.$router.push({ path:"/login" });

this.$router.push({ path:"/login",query:{username:"jack"} });

this.$router.go( n );//n为数字,参考history.go

this.$router.go( -1 );  //用法类似于 history.go(-1)


$route 地址栏所有信息 --- 利用它获取地址栏动态参数,查询参数...

$router 路由对象  ---  利用它实现编程式导航

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容