Skip to content

Commit

Permalink
fix(useVirtualList): .style can be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Nov 10, 2023
1 parent e6c7872 commit 3d6b9c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/useVirtualList/component.ts
Expand Up @@ -36,7 +36,8 @@ export const UseVirtualList = /* #__PURE__ */ defineComponent<UseVirtualListProp
const { list, containerProps, wrapperProps, scrollTo } = useVirtualList(listRef, props.options)
expose({ scrollTo })

typeof containerProps.style === 'object' && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || '300px')
if (containerProps.style && typeof containerProps.style === 'object' && !Array.isArray(containerProps.style))
containerProps.style.height = props.height || '300px'

return () => h('div', { ...containerProps }, [
h('div', { ...wrapperProps.value }, list.value.map((item: any) => h('div', { style: { overFlow: 'hidden', height: item.height } }, slots.default ? slots.default(item) : 'Please set content!'))),
Expand Down

0 comments on commit 3d6b9c6

Please sign in to comment.