|
@@ -1,4 +1,7 @@
|
|
import {
|
|
import {
|
|
|
|
+ AsyncComponentLoader,
|
|
|
|
+ Component,
|
|
|
|
+ ComponentPublicInstance,
|
|
defineAsyncComponent,
|
|
defineAsyncComponent,
|
|
// FunctionalComponent, CSSProperties
|
|
// FunctionalComponent, CSSProperties
|
|
} from 'vue';
|
|
} from 'vue';
|
|
@@ -27,7 +30,11 @@ interface Options {
|
|
retry?: boolean;
|
|
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;
|
|
const { size = 'small', delay = 100, timeout = 30000, loading = false, retry = true } = options;
|
|
return defineAsyncComponent({
|
|
return defineAsyncComponent({
|
|
loader,
|
|
loader,
|