Traditional Culture Encyclopedia - Traditional stories - Vue routing implementation principle summary

Vue routing implementation principle summary

Before learning VueSSR when there has been a question, since SSR than SPA first screen loading faster and SEO-friendly, but also compatible with multiple ends (such as and WEEX combination), why SPA can fire up. Later found that one of the important point is that the route switching experience is better than SSR (also seen before, just learned now slowly experience out).

Before we get into the vue routing implementation, let's look at the default object properties of the browser object location

All of the above properties and methods, except hash, reload the page.

The pushState and replaceState methods add and replace a record respectively (must be from the same source) without reloading the page.

The only difference between window.location.hash and window.history.pushState (or replaceState) is that the url carries # through the hash change, which it does not. And the two modes of Vue routing are based on the 2 objects location and history!

blogs.com/historymemory/p/6393539.html