element-plus / element-plus

🎉 A Vue.js 3 UI Library made by Element team
https://element-plus.org
MIT License
24.18k stars 15.91k forks source link

[Component] [tree-select] show-checkbox为true时,props属性无效 #12369

Open sscfaith opened 1 year ago

sscfaith commented 1 year ago

Bug Type: Component

Environment

Reproduction

Related Component

Reproduction Link

Element Plus Playground

Steps to reproduce

链接

What is Expected?

props有效

What is actually happening?

props无效

Additional comments

(empty)

liuxin00020 commented 1 year ago

tree可以正常显示,但是选中的值,在select上是undefined,v-model绑定的值也是undefined,选中的个数正常,值估计是绑定的props没有映射上

lzl0304 commented 1 year ago

:props="{ label: 'name', value: 'id' }"问题出在这里。文档上注明了TreeSelect是el-tree和el-select的结合体props中没有value属性。因为show-checkbox属性为true时,会使用props.nodeKey || props.valueKey || 'value'查找选择的选项,所以简单点,加上node-key="id"就好了。

slc6666 commented 1 year ago

谢谢大佬,解决了我的问题****