element [bug report] Tree: when the default checked keys are the first two child nodes, it is judged that all the child nodes are checked by mistake

t0ybt7op  于 3个月前  发布在  其他
关注(0)|答案(2)|浏览(60)

Element UI version

2.13.1

OS/Browsers version

macOS 10.15.4/Chrome版本 81.0.4044.138

Vue version

2.6.11

https://codepen.io/ilyp/pen/KKdBqaQ?cf_chl_jschl_tk=9e046696012765b98719baba051a972ecd7e4a7c-1589359630-0-AVNC8yK_tHAY2AxyypbTT2Ppli7EoYwZ-BUW7pTrHjYRzKSaAHTcTQjZiDV9tmfqT8-45OebYgpqmEuXBjTTr5ci1Vrlt2U27B7qikT9ZmZXUEPM-F7baQIhTfK_P8zde44CCu7GvQUbrQs4OsV7PouapY1YpnA2yViEy7Pl_ipanWNji3HsNhLRlHewlExKBig1HIA_0lECs7N7uBCu5gcbANxD5gQq6G4jlNSfXFYp5YUtnHvdA6TJ4InT4usbv1bykTJaE1Qd39wgYZFfqIIgYmqswWcA9pnO5doRpNltSR00SqcVIYjC-98XErkD29D1SJe2YO_aLYoWwqG0vM8z99TaO0M4Ksz6v5HzfXiy

Steps to reproduce

1.模板:

<el-tree
  ref="tree"
  show-checkbox
  lazy
  node-key="id"
  :load="loadNode"
  :default-checked-keys="['1','2']"
>
</el-tree>
  1. 节点加载函数
loadNode (node, resolve) {
  if (node.level === 0) {
    return resolve([{ id: '0', label: 'root' }]);
  }
  if (node.level > 1) {
    return resolve([]);
  }
  return resolve([{ id: '1', label: '1'}, { id: '2', label: '2'}, { id: '3', label: '3'}]);
}

What is Expected?

点击root节点(并未点击复选框),渲染结果只选中id为'1','2'的2个子节点

What is actually happening?

点击root节点(并未点击复选框),结果root节点和所有子节点全部被选中

flseospp

flseospp1#

Translation of this issue:

Element UI version

2.13.1

OS/Browsers version

Mac OS 10.15.4/chrome version 81.0.4044.138

Vue version

2.6.11

https://codepen.io/ilyp/pen/KKdBqaQ?cf_chl_jschl_tk=9e046696012765b98719baba051a972ecd7e4a7c-1589359630-0-AVNC8yK_tHAY2AxyypbTT2Ppli7EoYwZ-BUW7pTrHjYRzKSaAHTcTQjZiDV9tmfqT8-45OebYgpqmEuXBjTTr5ci1Vrlt2U27B7qikT9ZmZXUEPM-F7baQIhTfK_P8zde44CCu7GvQUbrQs4OsV7PouapY1YpnA2yViEy7Pl_ipanWNji3HsNhLRlHewlExKBig1HIA_0lECs7N7uBCu5gcbANxD5gQq6G4jlNSfXFYp5YU tnHvdA6TJ4InT4usbv1bykTJaE1Qd39wgYZFfqIIgYmqswWcA9pnO5doRpNltSR00SqcVIYjC-98XErkD29D1SJe2YO_aLYoWwqG0vM8z99TaO0M4Ksz6v5HzfXiy

Steps to reproduce

  1. Template:


<el-tree

ref="tree"
show-checkbox

lazy
node-key="id"

:load="loadNode"
:default-checked-keys="['1','2']"


2. Node loading function


loadNode (node, resolve) {

if (node.level === 0) {
return resolve([{ id: '0', label: 'root' }]);

}
if (node.level > 1) {

return resolve([]);
}

return resolve([{ id: '1', label: '1'}, { id: '2', label: '2'}, { id: '3', label: '3'}]);
}

What is Expected?

Click the root node (without clicking the check box), and only 2 child nodes with ID '1' and '2' will be selected in the rendering result

What is actually happening?

Click the root node (without clicking the check box), and the root node and all child nodes will be selected

swvgeqrz

swvgeqrz2#

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.

相关问题