Commit 1a43142252328adf1d0870e8e406f7d0fa70af65
Committed by
GitHub
1 parent
52e295f1
fix(form component): fix form 'vertical' layout row width (#1535)
Showing
1 changed file
with
6 additions
and
3 deletions
src/components/Form/src/hooks/useLabelWidth.ts
1 | 1 | import type { Ref } from 'vue'; |
2 | -import type { FormProps, FormSchema } from '../types/form'; | |
3 | - | |
4 | 2 | import { computed, unref } from 'vue'; |
3 | +import type { FormProps, FormSchema } from '../types/form'; | |
5 | 4 | import { isNumber } from '/@/utils/is'; |
6 | 5 | |
7 | 6 | export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref<FormProps>) { |
... | ... | @@ -14,6 +13,7 @@ export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref< |
14 | 13 | labelWidth: globalLabelWidth, |
15 | 14 | labelCol: globalLabelCol, |
16 | 15 | wrapperCol: globWrapperCol, |
16 | + layout, | |
17 | 17 | } = unref(propsRef); |
18 | 18 | |
19 | 19 | // If labelWidth is set globally, all items setting |
... | ... | @@ -33,7 +33,10 @@ export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref< |
33 | 33 | |
34 | 34 | return { |
35 | 35 | labelCol: { style: { width }, ...col }, |
36 | - wrapperCol: { style: { width: `calc(100% - ${width})` }, ...wrapCol }, | |
36 | + wrapperCol: { | |
37 | + style: { width: layout === 'vertical' ? '100%' : `calc(100% - ${width})` }, | |
38 | + ...wrapCol, | |
39 | + }, | |
37 | 40 | }; |
38 | 41 | }); |
39 | 42 | } | ... | ... |