ant-design-vue/components/vc-virtual-list/hooks/useChildren.jsx
2020-09-28 19:14:00 +08:00

24 lines
538 B
Vue

import { Item } from '../Item';
export default function useChildren(
list,
startIndex,
endIndex,
setNodeRef,
renderFunc,
{ getKey },
) {
return list.slice(startIndex, endIndex + 1).map((item, index) => {
const eleIndex = startIndex + index;
const node = renderFunc(item, eleIndex, {
// style: status === 'MEASURE_START' ? { visibility: 'hidden' } : {},
});
const key = getKey(item);
return (
<Item key={key} setRef={ele => setNodeRef(item, ele)}>
{node}
</Item>
);
});
}