Browse Source
feat: replace `ElSelect` with `ElSelectV2` in component adapter for butter performance (#5085)
pull/5101/head
Arthur Darkstone
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
1 additions and
17 deletions
-
apps/web-ele/src/adapter/component/index.ts
|
|
|
@ -22,11 +22,9 @@ import { |
|
|
|
ElInput, |
|
|
|
ElInputNumber, |
|
|
|
ElNotification, |
|
|
|
ElOption, |
|
|
|
ElRadio, |
|
|
|
ElRadioButton, |
|
|
|
ElRadioGroup, |
|
|
|
ElSelect, |
|
|
|
ElSelectV2, |
|
|
|
ElSpace, |
|
|
|
ElSwitch, |
|
|
|
@ -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, |
|
|
|
|