-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Select: use primitive key on tags #5897
Conversation
感觉直接用 index 不合适吧? |
@wacky6 不合适是指? |
直觉上感觉不太对,item 和 index 不能算一一对应吧,比如: selected = 这两个出来的 key 是一样的。vue文档里建议key是元素的唯一标识。 |
766e289
to
39e3f4c
Compare
@wacky6 有道理。 现在改成了和 Tree 以及 Table 类似的处理方式,如果 item 是对象的话,要求用户传一个 以此为契机,修改了判断某个选项是否选中的代码,达到这样一个效果:如果 Select 的绑定值为对象且有初始值,不再要求初始值和 option 中的某个值必须引用同一个对象;而是只要两者 |
LGTM。建议加几个测试用例 |
@wacky6 will do. |
39e3f4c
to
d832be7
Compare
@Leopoldthecoder 如果下拉配置项option没有value值, 组件的回显就报错了: option:[ { id:'01', label:'萝莉' }, { id:'02', label:'御姐' } ]
<el-select v-model="model" multiple>
<el-option v-for="item in option" :key="item.id" :label="item.label" :value="item" value-key="id">
</el-option>
</el-select> vue报错警告, 多选无法回显选中项 element-ui 1.4.1 |
@Moerj |
select的remove-tag不能用吗~ 调用了没有反应 求助 |
才注意到1.4.0加了value-key, 小伙伴把包升级后,之前好多select组件都挂了,这是个break changing....... |
@chikara-chan 是啊,changelog 里已经注明是非兼容性更新了。 |
如果循环里是一个map呢?value-key又该怎么写?value-key到底是写在select上还是写在option上 |
我也很困惑,文档写value-key,但示例上全是在option上用 :key,你现在理解了没? |
Please make sure these boxes are checked before submitting your PR, thank you!
dev
branch.#5894