Skip to content

Commit

Permalink
fixup! feat: Lazy load diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
ahtrotta committed Mar 26, 2024
1 parent f8b049f commit 0c1579c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/components/src/components/LazyLoader.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
<template>
<div class="lazy-loader-container">
<slot v-if="shouldRender" />
<div v-if="shouldRender">
<slot />
</div>
<v-loading-spinner v-else />
</div>
</template>

<script lang="ts">
import Vue from 'vue';
import VLoadingSpinner from '@/components/LoadingSpinner.vue';
export default Vue.extend({
name: 'v-lazy-loader',
components: {
VLoadingSpinner,
},
data() {
return {
shouldRender: false,
};
},
mounted() {
this.$nextTick(() => {
this.shouldRender = true;
Vue.nextTick(() => {
setTimeout(() => {
this.shouldRender = true;
}, 0);
});
},
});
Expand Down

0 comments on commit 0c1579c

Please sign in to comment.