Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace ElSelect with ElSelectV2 in component adapter for better performance #5085

Merged
merged 6 commits into from
Dec 11, 2024
18 changes: 1 addition & 17 deletions apps/web-ele/src/adapter/component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ import {
ElInput,
ElInputNumber,
ElNotification,
ElOption,
ElRadio,
ElRadioButton,
ElRadioGroup,
ElSelect,
ElSelectV2,
ElSpace,
ElSwitch,
Expand Down Expand Up @@ -165,21 +163,7 @@ async function initComponentAdapter() {
);
},
Select: (props, { attrs, slots }) => {
let defaultSlot;
if (Reflect.has(slots, 'default')) {
defaultSlot = slots.default;
} else {
const { options } = attrs;
if (Array.isArray(options)) {
defaultSlot = () => options.map((option) => h(ElOption, option));
}
}
const placeholder = props?.placeholder || $t(`ui.placeholder.select`);
return h(
ElSelect,
{ ...props, ...attrs, placeholder },
{ ...slots, default: defaultSlot },
);
return h(ElSelectV2, { ...props, attrs }, slots);
},
Space: ElSpace,
Switch: ElSwitch,
Expand Down
Loading