feat(loading-bar): add configurable duration property

This commit is contained in:
pyyzcwg2833 2019-03-22 11:47:27 +08:00
parent f0de3cc7a9
commit c82c4bb8a9
2 changed files with 10 additions and 1 deletions

View file

@ -2,6 +2,7 @@ import LoadingBar from './loading-bar';
let loadingBarInstance; let loadingBarInstance;
let color = 'primary'; let color = 'primary';
let duration = 800;
let failedColor = 'error'; let failedColor = 'error';
let height = 2; let height = 2;
let timer; let timer;
@ -32,7 +33,7 @@ function hide() {
percent: 0 percent: 0
}); });
}, 200); }, 200);
}, 800); }, duration);
} }
function clearTimer() { function clearTimer() {
@ -96,6 +97,9 @@ export default {
if (options.color) { if (options.color) {
color = options.color; color = options.color;
} }
if (options.duration) {
duration = options.duration;
}
if (options.failedColor) { if (options.failedColor) {
failedColor = options.failedColor; failedColor = options.failedColor;
} }

View file

@ -41,6 +41,11 @@ export declare interface LoadingBarConfig {
* @default primary * @default primary
*/ */
color?: string; color?: string;
/**
* , 800ms
* @default 800
*/
duration?: number;
/** /**
* iView * iView
* @default error * @default error