diff --git a/src/components/loading-bar/index.js b/src/components/loading-bar/index.js index b7a69e6d..7a9dd6ee 100644 --- a/src/components/loading-bar/index.js +++ b/src/components/loading-bar/index.js @@ -2,6 +2,7 @@ import LoadingBar from './loading-bar'; let loadingBarInstance; let color = 'primary'; +let duration = 800; let failedColor = 'error'; let height = 2; let timer; @@ -32,7 +33,7 @@ function hide() { percent: 0 }); }, 200); - }, 800); + }, duration); } function clearTimer() { @@ -96,6 +97,9 @@ export default { if (options.color) { color = options.color; } + if (options.duration) { + duration = options.duration; + } if (options.failedColor) { failedColor = options.failedColor; } diff --git a/types/loading-bar.d.ts b/types/loading-bar.d.ts index 4e4d9c01..8ddb8fab 100644 --- a/types/loading-bar.d.ts +++ b/types/loading-bar.d.ts @@ -41,6 +41,11 @@ export declare interface LoadingBarConfig { * @default primary */ color?: string; + /** + * 自动消失的延时, 默认为800ms + * @default 800 + */ + duration?: number; /** * 失败时的进度条颜色,默认为 iView 主色 * @default error