Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the differences between vue router redirects and aliases

Shulou Source: shulou.com Published: 2022-06-02 23:11:04 11月15日 Update

This article mainly introduces "what is the difference between vue router redirection and alias". In daily operation, I believe that many people have doubts about the difference between vue router redirection and aliases. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "what is the difference between vue router redirection and aliases?" Next, please follow the editor to study!

Difference: redirect refers to jump to another page, its function is to prevent users from typing file names, when the user enters a system-independent path will jump to the specified page. Alias refers to adding a new path to the route so that no matter which path is applied, the page content of the same route will eventually be displayed; aliases can be used to hide the real path.

The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.

Differences between vue router redirects and aliases

Redirect official description:

When the user accesses / a, the URL will be replaced with / b, and then the matching route will be / b

Role: personal understanding, the role of vue router redirection is to prevent users from typing file names, when the user enters a path that has nothing to do with the system will jump to the specified page.

Description of the alias:

The alias of / an is / b, which means that when the user accesses / b, the URL remains at / b, but the route match is / a, just as the user accesses / a.

In fact, it is to add a "nickname" to a route-a new path, so that no matter which path is applied, the page content of the same route will eventually be displayed.

The effects of this extension are as follows:

1. Hide the path

2. When writing code, you can replace the actual path with an alias. At that time, if the jump page in the project needs to be changed, you only need to change the routing configuration, which can be regarded as a variable of the path.

At this point, the study on "what is the difference between vue router redirection and aliases" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Routing alias path user page role learning system content file name more help application input utility then next personal code Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Technology Apple macOS Microsoft