In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
What I want to share with you today is what is the difference between router and route of vue. I believe many people don't know much about it. In order to make you understand better, I summarized the following contents for you. Let's look down together. I'm sure you'll get something.
Difference: router gets an instance object through the "Vue.use (VueRouter)" and VueRouter constructor, which is a global object. Route is a jump routing object, each route will have a route object, is a local object.
The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.
What is router?
Router is an object of VueRouter, through Vue.use (VueRouter) and VueRouter constructor to get an instance object of router, this object is a global object, it contains all routes contain many key objects and properties.
Similar to history object
$router.push ({path:'home'}); essentially adding a route to the history stack, which in our view is switching routes, but essentially adding a history record
Methods:
$router.replace ({path:'home'}); / / replace the route with no history
What is route?
Route is a jump routing object, each route will have a route object, is a local object, you can get the corresponding name,path,params,query, etc.
$route.path
The string, which is equal to the path of the current routing object, is resolved to an absolute path, such as "/ home/news".
$route.params
Object that contains key-value pairs of dynamic fragments and fully matched fragments in the route
$route.query
Object that contains the key-value pairs of query parameters in the route. For example, for / home/news/detail/01?favorite=yes, you get $route.query.favorite = = 'yes'.
$route.router
The router to which the routing rule belongs (and the components it belongs to).
$route.matched
Array containing the configuration parameter objects for all fragments contained in the currently matched path.
$route.name
The name of the current path. If no named path is used, the name is empty.
The attributes of $route.path, $route.params, $route.name and $route.query are easy to understand and are mainly used to receive the parameters passed by the route.
About vue router and route what difference is shared here, I hope that the above content can have a certain reference value, you can learn to apply. If you like this article, you might as well share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 293
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.