$route 和$router 的区别是什么?

$route 是“路由信息对象”, 包括 path, params, hash, query, fullPath, matched,
name 等路由信息参数。
$router 为 VueRouter 的实例, 相当于一个全局的路由器对象, 里面含有很多
属性和子对象, 例如 history 对象, 经常用的跳转链接就可以用 this.router.push 会
往 history 栈中添加一个新的记录。 返回上一个 history 也是使用$router.go 方法

posted @ 2024-03-04 14:09  baiyujie02420  阅读(25)  评论(0)    收藏  举报