fix: The attribute of option does not work

This commit is contained in:
kailong321200875 2022-10-08 13:49:00 +08:00
parent b320e658d1
commit d946920e61
2 changed files with 10 additions and 2 deletions

View File

@ -29,8 +29,15 @@ export const useRenderSelect = (slots: Slots) => {
// 如果有别名,就取别名
const labelAlias = item?.componentProps?.optionsAlias?.labelField
const valueAlias = item?.componentProps?.optionsAlias?.valueField
const { label, value, ...other } = option
return (
<ElOption label={option[labelAlias || 'label']} value={option[valueAlias || 'value']}>
<ElOption
label={labelAlias ? option[labelAlias] : label}
value={valueAlias ? option[valueAlias] : value}
{...other}
>
{{
default: () =>
// option 插槽名规则,{field}-option

View File

@ -528,7 +528,8 @@ const schema = reactive<FormSchema[]>([
options: [
{
label: 'option1-1',
value: '1-1'
value: '1-1',
disabled: true
},
{
label: 'option1-2',