fix(components): [ElFormItem] label will be show undefined (#4487)

This commit is contained in:
C.Y.Kun 2021-11-23 00:17:19 +08:00 committed by GitHub
parent 0832a55f89
commit 8fe4f1e65e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,8 +10,8 @@
class="el-form-item__label"
:style="labelStyle"
>
<slot name="label" :label="label + elForm.labelSuffix">
{{ label + elForm.labelSuffix }}
<slot name="label" :label="currentLabel">
{{ currentLabel }}
</slot>
</label>
</LabelWrap>
@ -345,6 +345,10 @@ export default defineComponent({
)
})
const currentLabel = computed(
() => (props.label || '') + (elForm.labelSuffix || '')
)
return {
formItemRef,
formItemClass,
@ -356,6 +360,7 @@ export default defineComponent({
labelFor,
resetField,
clearValidate,
currentLabel,
}
},
})