Home > Web Front-end > JS Tutorial > Detailed explanation of steps to activate current routing in vue

Detailed explanation of steps to activate current routing in vue

php中世界最好的语言
Release: 2018-05-10 14:25:53
Original
1711 people have browsed it

This time I will bring you a detailed explanation of the steps for vue to activate the current route. What are the precautions for vue to activate the current route? . The following is a practical case, let's take a look.

A route object (routing information object) represents the status information of the currently activated route, including the information obtained by parsing the current URL, and the URL matching route records.

route object is immutable, and a new object will be generated after each successful navigation.

route object appears in multiple places:

In the component, that is, this.$route

In the $route observer callback

The return value of router.match(location) (the currently activated routing information can be obtained in main.js)

Note:

## The path of #this.$route and the path of router.match(location) are different. They both have a

attribute fullpath. The value is the concatenation of hash and path. Router.match(location) is in my This is always equal to /login, which should point to the root route. The hash is the current routing path with the tracing point #. Therefore, to use router.match(location) to obtain the currently activated route, you can only use the hash attribute. The reason is not yet known. . .

# I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Detailed explanation of the steps for vue1 and vue2 to obtain dom elements

Detailed explanation of the steps for Vue to dynamically create and delete data

The above is the detailed content of Detailed explanation of steps to activate current routing in vue. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template