Vue routing mode and hash mode history

hash mode: the browser symbol "#", # and # characters behind called hash, reading the window.location.hash;
Features: although the hash in the URL, but not included in the HTTP request; with to guide the browser action for server security useless, hash will not reload the page.
the hash mode, only the hash symbols before content is included in the request, such as http://www.xxx.com, so the rear end, even if there is no route to achieve full coverage, does not return 404 error.

mode history: history using the new HTML5 features; and provides two new methods: pushState (), replaceState () can modify the browser history stack, and listen popState events to the state change.
the history mode, the front end of the URL and the URL must initiate a request to the rear end of the actual consistency, such as http://www.xxx.com/items/id. If the lack of rear / items / id route processing, returns a 404 error. Vue-Router official website in such a description: "But this mode to play well, but also the background configuration support ...... So, you want to add a candidate resources to cover all situations in the service side: if the URL match any static resources, you should return the same index.html page, which is dependent on your app page. "

Guess you like

Origin www.cnblogs.com/wtsx-2019/p/12482599.html