From 8e33da231eab6700f1a3b29e5fb7686b898f2585 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Thu, 29 Sep 2022 15:06:50 +0800 Subject: [PATCH] =?UTF-8?q?vertical=20=E5=B8=83=E5=B1=80=E6=97=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=B8=83=E5=B1=80=E6=98=BE=E7=A4=BA=E9=94=99=E4=B9=B1?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/hooks/useLabelWidth.ts | 9 ++++++--- src/views/demo/page/form/high/index.vue | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/Form/src/hooks/useLabelWidth.ts b/src/components/Form/src/hooks/useLabelWidth.ts index 7fcc021..f994985 100644 --- a/src/components/Form/src/hooks/useLabelWidth.ts +++ b/src/components/Form/src/hooks/useLabelWidth.ts @@ -10,7 +10,7 @@ export function useItemLabelWidth(schemaItemRef: Ref, propsRef: Ref< const { labelCol = {}, wrapperCol = {} } = schemaItem.itemProps || {}; const { labelWidth, disabledLabelWidth } = schemaItem; - const { labelWidth: globalLabelWidth, labelCol: globalLabelCol, wrapperCol: globWrapperCol } = unref(propsRef); + const { labelWidth: globalLabelWidth, labelCol: globalLabelCol, wrapperCol: globWrapperCol,layout } = unref(propsRef); // update-begin--author:sunjianlei---date:20211104---for: 禁用全局 labelWidth,不自动设置 textAlign -------- if (disabledLabelWidth) { @@ -34,8 +34,11 @@ export function useItemLabelWidth(schemaItemRef: Ref, propsRef: Ref< } return { - labelCol: { style: { width }, ...col }, - wrapperCol: { style: { width: `calc(100% - ${width})` }, ...wrapCol }, + labelCol: { style: { width: width ? width : '100%' }, ...col }, + wrapperCol: { + style: { width: layout === 'vertical' ? '100%' : `calc(100% - ${width})` }, + ...wrapCol, + }, }; }); } diff --git a/src/views/demo/page/form/high/index.vue b/src/views/demo/page/form/high/index.vue index f8709a3..a0cdebf 100644 --- a/src/views/demo/page/form/high/index.vue +++ b/src/views/demo/page/form/high/index.vue @@ -33,6 +33,8 @@ baseColProps: { span: 6, }, + labelWidth: 200, + layout: 'vertical', schemas: schemas, showActionButtonGroup: false, }); @@ -41,6 +43,8 @@ baseColProps: { span: 6, }, + labelWidth: 200, + layout: 'vertical', schemas: taskSchemas, showActionButtonGroup: false, });