【Vue】this.$ router 与 this.$ route 的区别
1.this.$ router
this.$ router 访问路由器 ;
this.$router 是一个全局的路由器对象,包含了很多属性和对象(比如 history 对象),任何页面都可以调用其 push(), replace(), go() 等方法。
2.this.$ route
this.$ route 访问当前路由 ;
this.$ route 表示当前路由对象,每一个路由都会有一个 route 对象,是一个局部的对象,可以获取对应的 name, path, params, query 等属性。
参考:
Vue 中 this.$ router 与 this.$route 的区别 以及 push() 方法