mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-02-02 18:28:40 +08:00
feat: replace ElSelect
with ElSelectV2
in component adapter for butter performance (#5085)
This commit is contained in:
parent
07b1ad121c
commit
2cc918f79d
@ -22,11 +22,9 @@ import {
|
|||||||
ElInput,
|
ElInput,
|
||||||
ElInputNumber,
|
ElInputNumber,
|
||||||
ElNotification,
|
ElNotification,
|
||||||
ElOption,
|
|
||||||
ElRadio,
|
ElRadio,
|
||||||
ElRadioButton,
|
ElRadioButton,
|
||||||
ElRadioGroup,
|
ElRadioGroup,
|
||||||
ElSelect,
|
|
||||||
ElSelectV2,
|
ElSelectV2,
|
||||||
ElSpace,
|
ElSpace,
|
||||||
ElSwitch,
|
ElSwitch,
|
||||||
@ -165,21 +163,7 @@ async function initComponentAdapter() {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
Select: (props, { attrs, slots }) => {
|
Select: (props, { attrs, slots }) => {
|
||||||
let defaultSlot;
|
return h(ElSelectV2, { ...props, attrs }, slots);
|
||||||
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 },
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
Space: ElSpace,
|
Space: ElSpace,
|
||||||
Switch: ElSwitch,
|
Switch: ElSwitch,
|
||||||
|
Loading…
Reference in New Issue
Block a user