mirror of
https://github.com/vuejs/vue.git
synced 2024-11-22 04:39:46 +00:00
9d12106e21
close #12608
27 lines
659 B
TypeScript
27 lines
659 B
TypeScript
import { AsyncComponent, Component } from './options'
|
|
|
|
export type AsyncComponentResolveResult<T = Component> = T | { default: T } // es modules
|
|
|
|
export type AsyncComponentLoader<T = any> = () => Promise<
|
|
AsyncComponentResolveResult<T>
|
|
>
|
|
|
|
export interface AsyncComponentOptions {
|
|
loader: AsyncComponentLoader
|
|
loadingComponent?: Component
|
|
errorComponent?: Component
|
|
delay?: number
|
|
timeout?: number
|
|
// suspensible?: boolean
|
|
onError?: (
|
|
error: Error,
|
|
retry: () => void,
|
|
fail: () => void,
|
|
attempts: number
|
|
) => any
|
|
}
|
|
|
|
export function defineAsyncComponent(
|
|
source: AsyncComponentLoader | AsyncComponentOptions
|
|
): AsyncComponent
|