Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

feat: add prop transitionDuration #56

Open
wants to merge 2 commits into
base: vue-3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Use the `duration` parameter to set the animation loop duration in seconds (does
| is-full-screen | Boolean | false | Loader will overlay the full page |
| text | String | - | Text will appear below loader |
| text-style | Object | {} | Change style of the text below loader |
| transition-duration | Number \| String | 300 | The minimum appearing duration of transition in milliseconds |


# 🤝 Contributing
Expand Down
12 changes: 10 additions & 2 deletions src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div
v-show="isActive || isActiveDelay"
:class="{ 'velmld-full-screen': isFullScreen }"
:style="{ backgroundColor }"
:style="{ backgroundColor, transition }"
ref="velmld"
class="velmld-overlay"
>
Expand Down Expand Up @@ -71,6 +71,10 @@ export default {
delay: {
type: [String, Number],
default: 0
},
transitionDuration: {
type: [String, Number],
default: 300
}
},
data () {
Expand Down Expand Up @@ -99,6 +103,11 @@ export default {
}, ms)
}
},
computed: {
transition() {
return `opacity ${+this.transitionDuration}ms`
},
},
watch: {
/**
* Binding outside component value and inside component value.
Expand Down Expand Up @@ -130,7 +139,6 @@ export default {
right: 0;
bottom: 0;
left: 0;
transition: opacity .3s;
}
.velmld-spinner {
top: 50%;
Expand Down