feat(components): [select] support options prop rendering (#21203)

* feat(components): [select] support options prop rendering

* feat(components):[select] format

* feat(components):[select] format

* Update packages/components/select/src/select.vue

Thanks for the guidance!

Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com>

* Update packages/components/select/src/select.vue

Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com>

* Merge remote-tracking branch 'upstream/dev' into feat/autocomplete-size

* feat(components): [select] format

* feat(components): [select] Add test case

* feat(components): [select] Add doc

* Update packages/components/select/src/select.ts

Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com>

* feat(components): [select] Code optimization

* feat(components): [select] Code optimization

* feat(components): [select] format

* feat(components): [select] format

* docs: refact

* refactor: simplify

* chore: useless diff change

* Update shared.ts

* Update message.ts

* Update popper.ts

* Update result.ts

* Update form-item.ts

* Update cascader-panel.test.tsx

* chore: useless change

* Update select.vue

* Update option.vue

* Update select.vue

---------

Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com>
Co-authored-by: Dsaquel <291874700n@gmail.com>
This commit is contained in:
snowbitx
2025-07-29 09:54:30 +08:00
committed by GitHub
parent 54cb51f2d9
commit dbbacae7d1
5 changed files with 233 additions and 51 deletions

View File

@@ -270,6 +270,12 @@ export const selectProps = buildProps({
* @description which element the selection dropdown appends to
*/
appendTo: useTooltipContentProps.appendTo,
options: {
type: definePropType<Record<string, any>[]>(Array),
},
props: {
type: definePropType<SelectOptionProps>(Object),
},
...useEmptyValuesProps,
...useAriaProps(['ariaLabel']),
})
@@ -290,3 +296,8 @@ export type SelectProps = ExtractPropTypes<typeof selectProps>
export type SelectPropsPublic = __ExtractPublicPropTypes<typeof selectProps>
export type SelectEmits = EmitFn<typeof selectEmits>
export type SelectInstance = InstanceType<typeof Select> & unknown
export type SelectOptionProps = {
value?: string
label?: string
disabled?: string
}

View File

@@ -276,7 +276,15 @@
:created="true"
/>
<el-options>
<slot />
<slot>
<el-option
v-for="(item, index) in options"
:key="index"
:label="item[props?.label ?? 'label']"
:value="item[props?.value ?? 'value']"
:disabled="item[props?.disabled ?? 'disabled']"
/>
</slot>
</el-options>
</el-scrollbar>
<div