Commit c82c4bb8a97b27a2909a24b49f5261f1376f1ae2
1 parent
f0de3cc7
feat(loading-bar): add configurable duration property
Showing
2 changed files
with
10 additions
and
1 deletions
Show diff stats
src/components/loading-bar/index.js
... | ... | @@ -2,6 +2,7 @@ import LoadingBar from './loading-bar'; |
2 | 2 | |
3 | 3 | let loadingBarInstance; |
4 | 4 | let color = 'primary'; |
5 | +let duration = 800; | |
5 | 6 | let failedColor = 'error'; |
6 | 7 | let height = 2; |
7 | 8 | let timer; |
... | ... | @@ -32,7 +33,7 @@ function hide() { |
32 | 33 | percent: 0 |
33 | 34 | }); |
34 | 35 | }, 200); |
35 | - }, 800); | |
36 | + }, duration); | |
36 | 37 | } |
37 | 38 | |
38 | 39 | function clearTimer() { |
... | ... | @@ -96,6 +97,9 @@ export default { |
96 | 97 | if (options.color) { |
97 | 98 | color = options.color; |
98 | 99 | } |
100 | + if (options.duration) { | |
101 | + duration = options.duration; | |
102 | + } | |
99 | 103 | if (options.failedColor) { |
100 | 104 | failedColor = options.failedColor; |
101 | 105 | } | ... | ... |
types/loading-bar.d.ts