diff --git a/packages/taro-components/virtual-list/react/createListComponent.js b/packages/taro-components/virtual-list/react/createListComponent.js index 2c098bd74de1..c011ef3e3d00 100644 --- a/packages/taro-components/virtual-list/react/createListComponent.js +++ b/packages/taro-components/virtual-list/react/createListComponent.js @@ -473,6 +473,7 @@ export default function createListComponent ({ useIsScrolling, width, position, + renderTop, renderBottom, ...rest } = this.props @@ -546,6 +547,7 @@ export default function createListComponent ({ if (position === 'relative') { const pre = getItemOffset(this.props, startIndex, this) return createElement(outerElementType || outerTagName || 'div', outerElementProps, + renderTop, createElement(itemElementType || itemTagName || 'div', { key: `${id}-pre`, id: `${id}-pre`, @@ -566,6 +568,7 @@ export default function createListComponent ({ ) } else { return createElement(outerElementType || outerTagName || 'div', outerElementProps, + renderTop, createElement(innerElementType || innerTagName || 'div', { ref: innerRef, key: `${id}-inner`, diff --git a/packages/taro-components/virtual-list/react/index.d.ts b/packages/taro-components/virtual-list/react/index.d.ts index 49446523f793..19b32a2dcb20 100644 --- a/packages/taro-components/virtual-list/react/index.d.ts +++ b/packages/taro-components/virtual-list/react/index.d.ts @@ -21,6 +21,8 @@ interface VirtualListProps extends StandardProps { initialScrollOffset?: number /** 列表内部容器组件类型,默认值为 View。 */ innerElementType?: ComponentType + /** 顶部区域 */ + renderTop?: ReactNode /** 底部区域 */ renderBottom?: ReactNode /** 滚动方向。vertical 为垂直滚动,horizontal 为平行滚动。默认为 vertical。 */