vue-router in the difference between router and route of

1.router is an object of VueRouter, get an instance of an object through a router Vue.use (VueRouter) and VueRouter constructor, this object is a global object, it contains all the key routing contains many objects and attributes .

For example: history objects

$ Router.push ({path: 'home'}); essentially add a route to the history stack, in our view is the switching route, but the essence is added in a history record

method:

$ Router.replace ({path: 'home'}); // alternate route, no history

2.route routing object is a jump, each route will have a route object that is a partial object can acquire the corresponding name, path, params, query, etc.

$ route.path 
string object is equal to the current routing path, it may be resolved to an absolute path, such as  "/home/news" .

$ route.params 
objects, comprising a routing key and dynamic segment of the full-match fragment

$ route.query 
object containing key route query parameters right. For example, for  /home/news/detail/01?favorite=yes , you get $route.query.favorite == 'yes' .

$ route.router 
router (and the components to which it belongs) routing rule belongs.

$ route.matched 
array configuration parameter object contains all the segments matching the current paths contained in the corresponding.

$ route.name 
name of the current path, if no path named, the name is empty.

$route.path, $route.params, $route.name, $route.queryThese properties readily appreciated, primarily for routing the received parameters passed

 

Guess you like

Origin www.cnblogs.com/huayang1995/p/12632493.html