Vue obtains the method of the current active route, and vue obtains the current route
A route object (route information object) indicates the status information of the currently activated route, including the information parsed by the current URL, and the route records matched by the URL ).
Route object is immutable (immutable), and a new object is generated after each successful navigation.
Route object appears in multiple places:
In the component, that is, this. $ route
In the $ route observer callback
Returned value of router. match (location) (the current active route information can be obtained in main. js)
Note:
This. $ route path and router. the path of match (location) is different. They all have a property fullpath, whose values are hash and path concatenation, router. match (location) is always equal to/login here. It should point to the root route, and hash is the current route path with the tracking point #. Therefore, you must use the router. match (location) is used to obtain the currently activated route. Only the hash attribute can be used. The reason is unknown ..
The above vue obtains all the content of the current active route. I hope you can give us a reference and support the customer's house.