Answer the question
In order to leave comments, you need to log in
How to display already rendered page after vue router 2 route change?
Hello!
When you click on the router-link, the page (component-page) changes, and then, within a second, the rest of the components begin to load gradually - that is, I clearly see how they begin to be drawn. These look pretty ugly. How can I render in the background, and then show the user a fully rendered page in one frame?
Answer the question
In order to leave comments, you need to log in
Add a prefetch on asynchronous imports (sometimes (not always) it is advisable to remove them altogether)
component: () => import(/* webpackPrefetch: true */ 'path/to/component')
make sure that data for components is not received in created / mounted, and earlier, for example, it was stored in vuex in advance and / or while data was being received - skeletons or a loading screen with a spinner were displayed.
You can add the whole page to the else block, and put the v-if loader with the boolean flag. And on any condition to change this flag.
<template>
<div v-if="loader">
<span>loading...</span>
</div>
<div v-else>
<!--- тут ваша страница --->
</div>
</template>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question