Skip to content

Commit

Permalink
fix: 虚拟滚动下,value值不存在时选项不渲染问题 (#807)
Browse files Browse the repository at this point in the history
* fix: 虚拟滚动下,value值不存在时选项不渲染问题

* refactor: all key

* refactor: all key to string

---------

Co-authored-by: letgo <[email protected]>
  • Loading branch information
aringlai and letgo committed May 24, 2024
1 parent 5e94adb commit 7f34fe8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion components/select/optionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export default defineComponent({
const renderDefault = ({ source }: { source: SelectOption }) =>
source.__isGroup ? renderGroupOption(source) : renderOption(source);

const inValidValueKey = '_ALL_KEY_'

return () =>
enableVirtualScroll.value
? (
Expand All @@ -172,7 +174,12 @@ export default defineComponent({
emit('scroll', event);
}}
dataSources={props.options}
dataKey={'value'}
dataKey={(data) =>
// 兼容全部选项,value为空值的选项
data.value === null || data.value === undefined
? inValidValueKey + String(data.value)
: data.value
}
estimateSize={32}
keeps={14}
style={props.containerStyle}
Expand Down

0 comments on commit 7f34fe8

Please sign in to comment.