请问defineAsyncComponent 的delay设计目的是什么 #7013
Unanswered
Capyhw
asked this question in
Help/Questions
Replies: 2 comments 2 replies
-
文档中有说明: 关于另一个问题可以写成这样: const AsyncComp = defineAsyncComponent({
// 加载函数
loader: () => import('./Foo.vue'),
// 使用 jsx 语法设置 props
loadingComponent: <LoadingComponent prop="" />,
// 展示加载组件前的延迟时间,默认为 200ms
delay: 200,
// 加载失败后展示的组件
errorComponent: ErrorComponent,
// 如果提供了一个 timeout 时间限制,并超时了
// 也会显示这里配置的报错组件,默认值是:Infinity
timeout: 3000
}) 能不能生效没有验证过,你可以试一下。 |
Beta Was this translation helpful? Give feedback.
2 replies
-
文档写的没有错。我想文档想表达的意思应该是:大部分请求都会在 200 毫秒内返回,没必要显示 Loading 组件。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
请问defineAsyncComponent 的delay设计目的是什么
用于延时显示 loadingComponent,这样做的意义在哪?
我认为,这个delay应该设置在 loadingComponent 和 loader (真正要加载的组件)之间
另外,我还有一个问题,defineAsyncComponent 的loadingComponent 还支持props吗
Beta Was this translation helpful? Give feedback.
All reactions