Skip to content

Commit

Permalink
fix: modify execution timing
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Jan 19, 2021
1 parent 5959bd4 commit d3c66bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/varlet-ui/src/snackbar/core.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<slot>{{ content }}</slot>
</div>
<div class="var-snackbar__action">
<var-icon v-if="iconName" :transition="200" :name="iconName" />
<var-icon v-if="iconName" :transition="hasMounted ? 200 : 0" :name="iconName" />
<var-loading v-if="type === 'loading'" :type="loadingType" :size="loadingSize" />
<slot name="action" />
</div>
Expand Down Expand Up @@ -33,6 +33,7 @@ export default defineComponent({
props,
setup(props) {
const timer: Ref = ref(null)
const hasMounted: Ref<boolean> = ref(false)
const { zIndex } = useZIndex(props, 'show', 1)
useLock(props, 'show', 'lockScroll')
Expand Down Expand Up @@ -80,6 +81,7 @@ export default defineComponent({
watch(
() => props._update,
() => {
hasMounted.value = true
clearTimeout(timer.value)
timer.value = setTimeout(() => {
props['onUpdate:show']?.(false)
Expand All @@ -100,6 +102,7 @@ export default defineComponent({
snackbarStyle,
snackbarClass,
iconName,
hasMounted,
}
},
})
Expand Down

0 comments on commit d3c66bb

Please sign in to comment.