element icon indicating copy to clipboard operation
element copied to clipboard

[Bug Report] el-tree的勾选框在禁选和不禁选时表现不一致

Open aique127 opened this issue 1 year ago • 9 comments

Element UI version

2.15.14

OS/Browsers version

window/chrome

Vue version

2.7.16

Reproduction Link

https://codepen.io/aique127/pen/OJePKxd

Steps to reproduce

当default-checked-keys属性含有某个父节点和其部分子节点的key时,checkbox会发生如下不一致的情况:

1、当disabled属性为true时,父节点的checkbox是半选状态,子节点包含在default-checked-keys中的是全选状态、不包含在内的是未选状态。 捕获1

2、当disabled属性为false时,父节点的checkbox是全选状态,子节点全部都是全选状态。 捕获2

这种情况在实际业务中很让人疑惑甚至出现bug,比如我本来父节点和子节点都是全选的,我新增一个未选的子节点后父节点应该变成半选状态才对,但实际上父节点和新增的子节点都变成了全选。

What is Expected?

上述第1 种。

What is actually happening?

根据disabled属性的不同有不同的勾选状态。

看setChecked方法的源码,是因为受到了passValue参数影响,能否将这个属性去掉呢?

image

aique127 avatar Jul 11 '24 17:07 aique127

@wangdaodao @webvs2 大佬们,如果不是一个bug,给一个合理的解释也行。。。

aique127 avatar Jul 16 '24 07:07 aique127

@wangdaodao @webvs2 大佬们,如果不是一个bug,给一个合理的解释也行。。。

我感觉算是一个bug,禁用和非禁用情况下,表现应该要保持一致。

wangdaodao avatar Jul 22 '24 02:07 wangdaodao

I will check this issue in the near future, and I am sorry that I have no time to pay attention to it

webvs2 avatar Jul 22 '24 02:07 webvs2

Can I also offer pr on this release @aique127 https://github.com/webvs2/element

webvs2 avatar Jul 22 '24 02:07 webvs2

Can I also offer pr on this release @aique127 https://github.com/webvs2/element

大佬,我已经提了一个,看看可以吗 https://github.com/ElemeFE/element/pull/22921

aique127 avatar Jul 22 '24 02:07 aique127

I can sync the past, but the change of the problem is currently in the lts version to fix. For the release information, see this #22741

webvs2 avatar Jul 22 '24 03:07 webvs2

I can sync the past, but the change of the problem is currently in the lts version to fix. For the release information, see this #22741

你好,官方版本不再更新了吗,以后都会更新到elementui-lts?

aique127 avatar Jul 22 '24 04:07 aique127

I can sync the past, but the change of the problem is currently in the lts version to fix. For the release information, see this #22741

你好,官方版本不再更新了吗,以后都会更新到elementui-lts?

For now, the official update frequency is slow, so extending a version with a higher hot update frequency, I recommend using lts

webvs2 avatar Jul 23 '24 02:07 webvs2

请问elementui-lts的源码在哪里可以获取?

zhousheng193 avatar Sep 24 '24 02:09 zhousheng193

Same here, any updates?

justforuse avatar Nov 01 '24 06:11 justforuse