Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

页面中局部组件加载失败了怎么重新加载 #8524

Closed
lanxuebao opened this issue Jul 19, 2018 · 3 comments
Closed

页面中局部组件加载失败了怎么重新加载 #8524

lanxuebao opened this issue Jul 19, 2018 · 3 comments

Comments

@lanxuebao
Copy link

Version

2.5.17-beta.0

Reproduction link

http://www.baidu.com

Steps to reproduce

vue官网有段代码是关于异步组件的,代码如下:

const AsyncComponent = (path) => ({
// 需要加载的组件 (应该是一个 Promise 对象)
component: import(@/${path}),
// 异步组件加载时使用的组件
loading: Loading,
// 加载失败时使用的组件
error: LoadingError,
// 展示加载时组件的延时时间。默认值是 200 (毫秒)
delay: 200,
// 如果提供了超时时间且组件加载也超时了,
// 则使用加载失败时使用的组件。默认值是:Infinity
timeout: 1000
});

请问页面如果局部组件加载失败了,怎么重新重新加载局部组件?
应用场景:在听歌曲时,可以给歌曲评论,查看评论列表。如果组件加载失败了,怎么能重新加载局部组件?而不是通过刷新整个页面达到目的?如果刷新整个页面则会造成歌曲重播,这个是不符合业务场景的。

What is expected?

想知道页面局部组件怎么重新加载或者重新创建渲染

What is actually happening?

页面局部组件加载失败后怎么重试加载局部组件?

@yyx990803
Copy link
Member

强制父组件重新渲染即可。

@lanxuebao
Copy link
Author

@yyx990803
我要反馈bug了,我在父组建vif重新渲染无效,整个vue也destroy依旧不好使。3.0的vu e

@yyx990803
Copy link
Member

报 bug 请新开 issue,带上重现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants