Home>Article>Web Front-end> What is the difference between vue router redirect and alias
Difference: Redirection refers to jumping to another page. Its function is to prevent the user from entering random file names. When the user enters a path that has nothing to do with the system, it will jump to the specified page. Aliases refer to adding a new path to a route, so that no matter which path is applied, the page content of the same route will eventually be displayed; using aliases can hide the real path from the outside.
The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.
The difference between vue router redirection and alias
##Official description of redirection:
当用户访问 /a时,URL 将会被替换成 /b,然后匹配路由为 /b,Function: Personal understanding, the purpose of vue router redirection is to prevent users from randomly entering file names. When users enter a path that has nothing to do with the system, they will jump to the specified page.
Description of alias:
/a 的别名是 /b,意味着,当用户访问 /b 时,URL 会保持为 /b,但是路由匹配则为 /a,就像用户访问 /a 一样。In fact, it is to add a "flower name" - a new path to a route, so that no matter which path is applied to it, it will eventually be displayed Page content of the same route. The functions of this extension are as follows: 1. Hide the path from the outside 2. When writing code, you can use an alias instead of the actual path. If the project jumps If the page needs to be changed, you only need to change the routing configuration, which can be used as a path variable. Related recommendations: "
vue.js Tutorial"
The above is the detailed content of What is the difference between vue router redirect and alias. For more information, please follow other related articles on the PHP Chinese website!