From e1613fa9d40423ab9382cde3a3553ae89a105e94 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 27 Dec 2021 15:40:48 +0800 Subject: [PATCH] fix: select not scroll, close #5082 --- components/vc-virtual-list/Item.tsx | 3 ++- components/vc-virtual-list/List.tsx | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/components/vc-virtual-list/Item.tsx b/components/vc-virtual-list/Item.tsx index cee01ed44..4924f26f1 100644 --- a/components/vc-virtual-list/Item.tsx +++ b/components/vc-virtual-list/Item.tsx @@ -1,12 +1,13 @@ import type { FunctionalComponent, PropType } from 'vue'; import { cloneVNode } from 'vue'; +import { flattenChildren } from '../_util/props-util'; export interface ItemProps { setRef: (element: HTMLElement) => void; } const Item: FunctionalComponent = ({ setRef }, { slots }) => { - const children = slots.default?.(); + const children = flattenChildren(slots.default?.()); return children && children.length ? cloneVNode(children[0], { diff --git a/components/vc-virtual-list/List.tsx b/components/vc-virtual-list/List.tsx index 5860e8923..c55017c94 100644 --- a/components/vc-virtual-list/List.tsx +++ b/components/vc-virtual-list/List.tsx @@ -224,15 +224,6 @@ const List = defineComponent({ if (!useVirtual.value || !inVirtual.value) { return; } - if (!inVirtual.value) { - Object.assign(calRes, { - scrollHeight: offsetHeight.value, - start: 0, - end: mergedData.value.length - 1, - offset: undefined, - }); - return; - } let itemTop = 0; let startIndex: number | undefined;