Home > Web Front-end > Vue.js > body text

What is the difference between vue router redirect and alias

青灯夜游
Release: 2021-10-26 17:17:01
Original
2653 people have browsed it

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.

What is the difference between vue router redirect and alias

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,
Copy after login

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 一样。
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!