fix(select): 修复多选模式下key可能为undefined的场景 #8042
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
场景
Select组件为多选模式下,options从远程加载时。如果初始值中包含未加载到的option选项,会导致key值为undefined。
OverFlow组件在渲染标签Item时,如果没有key值会使用index作为key,并且当option的value值为number类型,则会导致key值重复并且删除Selected值会出现问题。
关联代码
复现场景
https://codesandbox.io/p/sandbox/elastic-river-ng9wcp?file=%2Fsrc%2FApp.vue%3A10%2C31
修复后
2025-02-14.14.54.56.mov