invalid w
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
1 deletions
-
src/utils/factory/createAsyncComponent.tsx
|
|
|
@ -1,4 +1,7 @@ |
|
|
|
import { |
|
|
|
AsyncComponentLoader, |
|
|
|
Component, |
|
|
|
ComponentPublicInstance, |
|
|
|
defineAsyncComponent, |
|
|
|
// FunctionalComponent, CSSProperties
|
|
|
|
} from 'vue'; |
|
|
|
@ -27,7 +30,11 @@ interface Options { |
|
|
|
retry?: boolean; |
|
|
|
} |
|
|
|
|
|
|
|
export function createAsyncComponent(loader: Fn, options: Options = {}) { |
|
|
|
export function createAsyncComponent< |
|
|
|
T extends Component = { |
|
|
|
new (): ComponentPublicInstance; |
|
|
|
}, |
|
|
|
>(loader: AsyncComponentLoader<T>, options: Options = {}) { |
|
|
|
const { size = 'small', delay = 100, timeout = 30000, loading = false, retry = true } = options; |
|
|
|
return defineAsyncComponent({ |
|
|
|
loader, |
|
|
|
|