perf: virtual list
parent
7aae6f675c
commit
4e70c6dd77
|
@ -7,7 +7,7 @@ import { isValidElement } from '../_util/props-util';
|
||||||
import createRef from '../_util/createRef';
|
import createRef from '../_util/createRef';
|
||||||
import type { PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
import { computed, defineComponent, nextTick, reactive, watch } from 'vue';
|
import { computed, defineComponent, nextTick, reactive, watch } from 'vue';
|
||||||
import List from '../vc-virtual-list/List';
|
import List from '../vc-virtual-list';
|
||||||
import type {
|
import type {
|
||||||
OptionsType as SelectOptionsType,
|
OptionsType as SelectOptionsType,
|
||||||
OptionData,
|
OptionData,
|
||||||
|
@ -346,7 +346,8 @@ const OptionList = defineComponent<OptionListProps<SelectOptionsType[number]>, {
|
||||||
onScroll={onScroll}
|
onScroll={onScroll}
|
||||||
virtual={virtual}
|
virtual={virtual}
|
||||||
onMouseenter={onMouseenter}
|
onMouseenter={onMouseenter}
|
||||||
children={({ group, groupOption, data, label, value }, itemIndex) => {
|
v-slots={{
|
||||||
|
default: ({ group, groupOption, data, label, value }, itemIndex) => {
|
||||||
const { key } = data;
|
const { key } = data;
|
||||||
// Group
|
// Group
|
||||||
if (group) {
|
if (group) {
|
||||||
|
@ -357,7 +358,15 @@ const OptionList = defineComponent<OptionListProps<SelectOptionsType[number]>, {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { disabled, title, children, style, class: cls, className, ...otherProps } = data;
|
const {
|
||||||
|
disabled,
|
||||||
|
title,
|
||||||
|
children,
|
||||||
|
style,
|
||||||
|
class: cls,
|
||||||
|
className,
|
||||||
|
...otherProps
|
||||||
|
} = data;
|
||||||
const passedProps = omit(otherProps, omitFieldNameList);
|
const passedProps = omit(otherProps, omitFieldNameList);
|
||||||
// Option
|
// Option
|
||||||
const selected = values.has(value);
|
const selected = values.has(value);
|
||||||
|
@ -425,6 +434,7 @@ const OptionList = defineComponent<OptionListProps<SelectOptionsType[number]>, {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
></List>
|
></List>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -269,7 +269,8 @@ export default defineComponent({
|
||||||
itemHeight={itemHeight}
|
itemHeight={itemHeight}
|
||||||
prefixCls={`${prefixCls}-list`}
|
prefixCls={`${prefixCls}-list`}
|
||||||
ref={listRef}
|
ref={listRef}
|
||||||
children={(treeNode: FlattenNode) => {
|
v-slots={{
|
||||||
|
default: (treeNode: FlattenNode) => {
|
||||||
const {
|
const {
|
||||||
pos,
|
pos,
|
||||||
data: { ...restProps },
|
data: { ...restProps },
|
||||||
|
@ -283,7 +284,6 @@ export default defineComponent({
|
||||||
delete restProps.children;
|
delete restProps.children;
|
||||||
|
|
||||||
const treeNodeProps = getTreeNodeProps(mergedKey, treeNodeRequiredProps);
|
const treeNodeProps = getTreeNodeProps(mergedKey, treeNodeRequiredProps);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MotionTreeNode
|
<MotionTreeNode
|
||||||
{...restProps}
|
{...restProps}
|
||||||
|
@ -305,6 +305,7 @@ export default defineComponent({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
></VirtualList>
|
></VirtualList>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -398,7 +398,7 @@ const List = defineComponent({
|
||||||
virtual,
|
virtual,
|
||||||
component: Component = 'div',
|
component: Component = 'div',
|
||||||
onScroll,
|
onScroll,
|
||||||
children,
|
children = this.$slots.default,
|
||||||
style,
|
style,
|
||||||
class: className,
|
class: className,
|
||||||
...restProps
|
...restProps
|
||||||
|
|
Loading…
Reference in New Issue