Skip to content

Commit edb6192

Browse files
committed
improve spinner inactive state using v-show
1 parent bc1b6b1 commit edb6192

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/components/Spinner.vue

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
2-
<svg class="spinner" :class="{ show: show }" width="44px" height="44px" viewBox="0 0 44 44">
3-
<circle class="path" fill="none" stroke-width="4" stroke-linecap="round" cx="22" cy="22" r="20"></circle>
4-
</svg>
2+
<transition>
3+
<svg class="spinner" :class="{ show: show }" v-show="show" width="44px" height="44px" viewBox="0 0 44 44">
4+
<circle class="path" fill="none" stroke-width="4" stroke-linecap="round" cx="22" cy="22" r="20"></circle>
5+
</svg>
6+
</transition>
57
</template>
68

79
<script>
@@ -19,14 +21,15 @@ $duration = 1.4s
1921
z-index 999
2022
right 15px
2123
bottom 15px
22-
opacity 0
2324
transition opacity .15s ease
2425
animation rotator $duration linear infinite
2526
animation-play-state paused
26-
27-
.spinner.show
28-
opacity 1
29-
animation-play-state running
27+
&.show
28+
animation-play-state running
29+
&.v-enter, &.v-leave-active
30+
opacity 0
31+
&.v-enter-active, &.v-leave
32+
opacity 1
3033
3134
@keyframes rotator
3235
0%

0 commit comments

Comments
 (0)