I'm developing vue2+nuxt application and I'm using vuex+persisted state package. In one of components I display div with condition basing on state boolean variable:
<template>
<div class="nav__topbar" v-if="show">
....
</div>
</template>
<script>
export default {
computed: {
show() {
return this.$store.state.navInfo.navInfo
}
}
}
</script>
Everything works fine - if this.$store.state.navInfo.navInfo
is true then it display if not it disapear. Also after refresh it still work.
The only issue that I can not solve is that when boolean is false after refresh div show for a part of second. It disapear after lets say .2s but even tho it's so fast it still make page "jumping" because .nav__topbar
is 100% width and 20vh height. So for a part of second I can see this div then it hide and all page jump up which looks very ugly and I can't ignore that.
Is there any way to prevent this behaviour?
Maybe I can make use of this fetch() or asyncData hooks provided by Nuxt?
stateLoaded = false
initially. So when the state is loaded anythibg that relies on it being loaded has to also rely on that one variable. – Simon Hyll