Why does the route in Vue adopt the hash route mode instead of the hypertext (Reference) mode?

Time:2020-2-17

1. There are two types of routing patterns in Vue

1. One is hash mode.

2. One is the history mode of H5.

2. Both the hash and history are from the BOM object. The BOM is from the window

3. window.location.hash

4. Hash belongs to window.location, while history directly belongs to window

5. window.history

6. In the routing mode, when the hash value changes, no network request will occur. However, when the hash value changes, only the corresponding components will be updated and no network request will be sent.

7. The principle of history to implement routing history. Pushstate() has a history, sends network requests, and uses stack heap.

The biggest advantage of stack memory is: first in first out

8. Research a method: learn through three points

1. Understand what it does

2. Know what its parameter represents

3. Know what the return value is

History schematic

  

 

 

History. Back() returns the previous level = = = history. Go (- 1)

history.forwords() === history.go(-1)

History. Replacestate() has no route to store memory and cannot return

Author: Jin Feifei
Mobile number (wechat synchronization): 17812718961
I hope this article can bring benefits to the friends who are learning the front-end or working friends. Don’t spray. If you have any suggestions, please give me more suggestions. Thank you!!!

Recommended Today

What is Baidu’s secure openrasp project?

What is Baidu‘s secure openrasp project? In the history of this article, the official account is from the public technology. Welcome to redistribute and share knowledge, and respect copyright tagging authors and sources. At the end of the conversation, c0debreak opened a “confidential document” for me to see. It’s a secret that a otaku has […]