mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-26 21:40:18 +08:00
fix(components): [form] no margin when there is no label (#9940)
This commit is contained in:
@ -377,6 +377,7 @@ const context: FormItemContext = reactive({
|
||||
labelId,
|
||||
inputIds,
|
||||
isGroup,
|
||||
hasLabel,
|
||||
addInputId,
|
||||
removeInputId,
|
||||
resetField,
|
||||
|
@ -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
|
||||
|
@ -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: (
|
||||
|
Reference in New Issue
Block a user