Skip to content

Commit 2555654

Browse files
Merge pull request #10 from SchnapsterDog/develop
feat: added loadingIsOver event
2 parents 084ec8e + f2934e0 commit 2555654

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/vue-preloader.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,21 @@ export default {
6161
if (percent < 100) {
6262
setTimeout(() => {
6363
this.percent = percent += 1
64-
this.$refs.loadingbar.style.width = `${this.percent}%`
64+
if (this.$refs.loadingbar) {
65+
this.$refs.loadingbar.style.width = `${this.percent}%`
66+
}
6567
}, this.loadingSpeed)
6668
} else {
69+
this.loadingIsOver()
6770
this.transitionIsOver()
6871
}
6972
},
7073
},
7174
},
7275
methods: {
76+
loadingIsOver() {
77+
this.$emit('loading-is-over')
78+
},
7379
setOverflowAuto() {
7480
document.body.style.overflow = 'auto'
7581
},

0 commit comments

Comments
 (0)