Skip to content

Commit

Permalink
fix: The attribute of option does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Oct 8, 2022
1 parent b320e65 commit d946920
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/components/Form/src/components/useRenderSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/views/Components/Form/DefaultForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,8 @@ const schema = reactive<FormSchema[]>([
options: [
{
label: 'option1-1',
value: '1-1'
value: '1-1',
disabled: true
},
{
label: 'option1-2',
Expand Down

0 comments on commit d946920

Please sign in to comment.