$route和$router的区别

2021-01-28 18:20发布

7条回答
桃酥超好吃
2021-01-29 13:49

$route是路由信息对象,包括‘path,hash,query,fullPath,matched,name’等路由信息参数;

比如在获取具体的路由参数时:$route.params

$router是路由实例对象,包括了路由的跳转方法,实例对象等。

比如在进行路由跳转时,可以使用push方法:

this.$router.push({

    path:'/index', 

})




一周热门 更多>