I want to create "skeleton loading" in Nuxt.js, but I have a problem with the moment when routing to the page. Nuxt.js doesn't change the page until the success of 'fetch' and 'asyncData' by default. Can I go to the page at once, and then wait for the data and fetch?
On the example:
<template>
<div>
<div class="sceleton-loading">
<h1> <svg> <!-- h1-empty content animation--> </svg> </h1>
</div>
<div class="content">
<h1>{{ val1 }}</h1>
</div>
</div>
</template>
<script>
export default {
async asyncData(){
let val1 = await (new Promise(resolve => setTimeout(
() => resolve('work'), 5000
)));
return {
val1
}
},
}
</script>