fix(components): [form] no margin when there is no label (#9940)

This commit is contained in:
Qiang
2022-09-27 22:54:00 +08:00
committed by GitHub
parent 7d1ecb6285
commit cc8b816bd9
4 changed files with 5 additions and 2 deletions

View File

@ -377,6 +377,7 @@ const context: FormItemContext = reactive({
labelId,
inputIds,
isGroup,
hasLabel,
addInputId,
removeInputId,
resetField,

View File

@ -88,8 +88,9 @@ export default defineComponent({
const { isAutoWidth } = props
if (isAutoWidth) {
const autoLabelWidth = formContext?.autoLabelWidth
const hasLabel = formItemContext?.hasLabel
const style: CSSProperties = {}
if (autoLabelWidth && autoLabelWidth !== 'auto') {
if (hasLabel && autoLabelWidth && autoLabelWidth !== 'auto') {
const marginWidth = Math.max(
0,
Number.parseInt(autoLabelWidth, 10) - computedWidth.value

View File

@ -52,6 +52,7 @@ export interface FormItemContext extends FormItemProps {
isGroup: boolean
labelId: string
inputIds: string[]
hasLabel: boolean
addInputId: (id: string) => void
removeInputId: (id: string) => void
validate: (