Skip to content

Conversation

@Carryours
Copy link

@Carryours Carryours commented Feb 14, 2025

场景

Select组件为多选模式下,options从远程加载时。如果初始值中包含未加载到的option选项,会导致key值为undefined。
OverFlow组件在渲染标签Item时,如果没有key值会使用index作为key,并且当option的value值为number类型,则会导致key值重复并且删除Selected值会出现问题。

关联代码

 // ================================= Item =================================
  const getKey = (item: any, index: number) => {
    if (typeof props.itemKey === 'function') {
      return props.itemKey(item);
    }
    return (props.itemKey && (item as any)?.[props.itemKey]) ?? index;
  };

复现场景

录屏2025-02-14 14 43 25

https://codesandbox.io/p/sandbox/elastic-river-ng9wcp?file=%2Fsrc%2FApp.vue%3A10%2C31

修复后

2025-02-14.14.54.56.mov

@github-actions
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Apr 16, 2025
@github-actions github-actions bot closed this Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant