The difference between the two modes of uniapp packaging hash and history

When uniapp is packaged into H5, there will be a routing mode for you to choose, there are two types: hash and history

insert image description here
The main differences between the two are as follows:

1: hash - the address bar will have #

For example, to start a uniapp project in HbuilderX, a # will be added after the address and then the page address, such as:

http://localhost/#/pages/index/index

Its characteristic is that although the hash appears in the URL, it will not be included in the HTTP request and has no effect on the backend at all, so changing the hash will not reload the page.

2: history - normal URL

For example this: http://localhost/pages/index/index

So you can choose according to your actual situation.

Supongo que te gusta

Origin blog.csdn.net/mashangzhifu/article/details/118416768
Recomendado
Clasificación