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

Data echo after lazy loading of [Bug Report] tree component selection #17549

Closed
yangmiao7 opened this issue Sep 25, 2019 · 2 comments
Closed
Labels

Comments

@yangmiao7
Copy link

Element UI version

2.11.1

OS/Browsers version

win 10

Vue version

2.6.10

Reproduction Link

https://jsfiddle.net/wtrvx13z/1/

Steps to reproduce

https://jsfiddle.net/x47j0dr6/ 案例中的情况只能用于load中的异步操作已经执行完毕,然后再用setCheckedKeys 进行勾选回显设置,业务中常见的懒加载情况为,load中的异步操作可能在不可预知的时间执行完毕,也初始化需要展开的展开项目为多个,load会多次执行,这个时候没法确定什么时间调用setCheckedKeys函数,只要setCheckedKeys不是在所有load异步操作结束之后调用的,就可能依然有问题

示例代码:https://jsfiddle.net/wtrvx13z/1/

相关问题:#13349 #14847

请问这种情况推荐如何处理

What is Expected?

选择懒加载的tree可以正确进行回显,使用setCheckedNodes后不用考虑load函数的执行完毕时间

What is actually happening?

setCheckedNodes必须保证在load执行完毕之后才能正常运行,否则会出现问题

@element-bot element-bot changed the title [Bug Report] tree 组件选择懒加载后数据回显问题 Data echo after lazy loading of [Bug Report] tree component selection Sep 25, 2019
@element-bot
Copy link
Member

Translation of this issue:

Element UI version

2.11.1

OS/Browsers version

Win 10

Vue version

2.6.10

Reproduction Link

Https://jsfiddle.net/wtrvx13z/1/

Steps to reproduce

Https://jsfiddle.net/x47j0dr6/The case can only be used when the asynchronous operation in load has been completed, and then check-back setting with setCheckedKeys. The common lazy loading situation in business is that the asynchronous operation in load may be completed at an unpredictable time, and also initialize the expansion that needs to be started. The setCheckedKeys function can not be called at this time. As long as setCheckedKeys is not invoked after all load asynchronous operations are completed, there may still be problems.

Example code: https://jsfiddle.net/wtrvx13z/1/
Relevant questions: #13349 #14847

How do you recommend to deal with this situation?

What is Expected?

Selecting lazy loaded tree can be correctly displayed, without considering the completion time of load function after using setCheckedNodes

What is actually happening?

SetCheckedNodes must be guaranteed to run properly after the load has been executed, otherwise problems will arise.

@stale
Copy link

stale bot commented Sep 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 26, 2020
@stale stale bot closed this as completed Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants