From 8fe4f1e65e9083869deac0647e6fb063905a3126 Mon Sep 17 00:00:00 2001 From: "C.Y.Kun" <30518686+emojiiii@users.noreply.github.com> Date: Tue, 23 Nov 2021 00:17:19 +0800 Subject: [PATCH] fix(components): [ElFormItem] label will be show undefined (#4487) --- packages/components/form/src/form-item.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/components/form/src/form-item.vue b/packages/components/form/src/form-item.vue index 0c0b98479b..aed91f780b 100644 --- a/packages/components/form/src/form-item.vue +++ b/packages/components/form/src/form-item.vue @@ -10,8 +10,8 @@ class="el-form-item__label" :style="labelStyle" > - - {{ label + elForm.labelSuffix }} + + {{ currentLabel }} @@ -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, } }, })