ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.12k stars 14.64k forks source link

[Bug Report] element tree : the leaf nodes will be all checked when the lazy is true and this default-checked-keys is continuously #18334

Open ayusli127 opened 4 years ago

ayusli127 commented 4 years ago

Element UI version

2.13.0

OS/Browsers version

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Vue version

2.6.10

Reproduction Link

https://codepen.io/51code/pen/mdyJPKW?&editable=true

Steps to reproduce

set the default-checked-keys like [2,3] or [2,3,4]

What is Expected?

nodes [2,3,4] will be checked;

What is actually happening?

nodes [2,3,4,5] will be checked;

mayf09 commented 4 years ago

same issue.

I think the problem is, when loadData(image 1) is running, it create a new node, then node init and call _initDefaultCheckedNode(image 2), but the node is not ready.

2019-12-23 18-49-23 的屏幕截图 https://github.com/ElemeFE/element/blob/v2.13.0/packages/tree/src/model/node.js#L314

2019-12-23 18-49-00 的屏幕截图 https://github.com/ElemeFE/element/blob/v2.13.0/packages/tree/src/model/node.js#L132

mayf09 commented 4 years ago

set default-checked-keys after all node expanded, work well.

stale[bot] commented 3 years ago

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.