File tree Expand file tree Collapse file tree 1 file changed +26
-10
lines changed
Expand file tree Collapse file tree 1 file changed +26
-10
lines changed Original file line number Diff line number Diff line change 11<template >
2- <div
2+ <div
33 :class =" $style.preloader"
44 :style =" preloader"
55 >
6- <slot
7- name =" container"
8- v-bind =" { percent }"
9- >
6+ <slot v-bind =" { percent }" >
107 <div
118 v-if =" percent < 100"
129 :class =" $style.percentBar"
@@ -63,16 +60,35 @@ export default {
6360 handler (percent ) {
6461 if (percent < 100 ) {
6562 setTimeout (() => {
66- this .percent = percent += 1 ;
67- this .$refs .loadingbar .style .width = ` ${ this .percent } %` ;
68- }, this .percentSpeed );
63+ this .percent = percent += 1
64+ this .$refs .loadingbar .style .width = ` ${ this .percent } %`
65+ }, this .percentSpeed )
66+ } else {
67+ this .transitionIsOver ()
6968 }
7069 },
7170 },
7271 },
72+ methods: {
73+ setOverflowHidden () {
74+ document .body .style .overflow = ' hidden'
75+ },
76+ setOverflowAuto () {
77+ document .body .style .overflow = ' auto'
78+ },
79+ transitionIsOver () {
80+ setTimeout (() => {
81+ this .$emit (' finish-loading' )
82+ this .setOverflowAuto ()
83+ }, this .transitionSpeed )
84+ },
85+ },
86+ beforeMount () {
87+ this .setOverflowHidden ()
88+ },
7389 mounted () {
74- this .percent = this .percent += 1 ;
75- }
90+ this .percent = this .percent += 1
91+ },
7692};
7793 </script >
7894<style lang="css" module>
You can’t perform that action at this time.
0 commit comments