Recently, learning to pass values between vUE routes involves two objects$route$routerThe difference between the two, I also checked some information through the Internet, and finally made the following summary

$router = VueRouter; $router = VueRouter; $router = VueRouter; $router = VueRouter; $router = VueRouter;

Take the history object as an example:

$router.push({path:’home’}); $router.push({path:’home’})

$router.replace({path:’home’}), // Replace route, no history

$router.push(‘/login’) to jump to the specified route

2.$route is a jump route object. Every route has a $route object, which is a local object, which can obtain the corresponding name, path, params, query, etc

The difference between the two can be seen in their different structures, and some of their properties are different.

$route.path A string equal to the path of the current routing object, which is resolved to an absolute path, such as /home/ews

The $route.params object, which contains dynamic fragments of the route and key-value pairs of fully matched fragments, is not concatenated to the url of the route

The $route.query object that contains the key-value pairs of the query parameters in the route. Will be concatenated to the route URL

$route.router Indicates the router to which the routing rule belongs

$route.matchd array that contains configuration parameter objects for all fragments contained in the currently matched path

$route.name Specifies the name of the current route. If no specific path is used, the name is empty