我是Vue / Vuetify的新手,并且对高速缓存刷新(在Chrome中)上的页面转换/渲染有疑问:
答案 0 :(得分:0)
您可以设置一个全局加载参数,默认情况下将其设置为false,然后在beforeMount中将其设置为true,在mount中将其设置为false。
//store/index.js
...
state: {
loading: false,
},
//yourComponent.vue
<template>
<div v-if="this.$store.state.loading">
//a spinner or progress bar
</div>
<div v-else>
//your component code
</div>
</template>
<script>
export default {
beforeMount() {
this.$store.state.loading = true
}
mounted() {
this.$store.state.loading = false
}
}
</script>
如果您正在使用服务器端渲染,则不会调用这些,因此您必须使用在初始化时调用的方法进行加载调用。