Skip to content

Commit 6b59786

Browse files
committed
fix: form gap 行列间距样式修复
1 parent 5a18e38 commit 6b59786

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/components/u-form.vue/docs/blocks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### 基础表单
22

33
``` html
4-
<u-form gap="large"
4+
<u-form
55
><u-form-item label="名称" required>
66
<u-input placeholder="由字母、数字和中划线组成"></u-input>
77
</u-form-item

src/components/u-form.vue/index.vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :class="$style.root" @submit.prevent :layout="layoutValue">
2+
<div :class="$style.root" @submit.prevent :layout="layoutValue" :repeat="repeat">
33
<slot></slot>
44
</div>
55
</template>
@@ -151,11 +151,15 @@ export default {
151151
margin-bottom: var(--form-item-margin-bottom-large);
152152
}
153153
154-
.root[gap-width="large"][layout="inline"] .item:not(:last-child) {
154+
.root[gap-height="normal"][layout="block"] .item:not(:last-child) {
155+
margin-bottom: var(--form-item-margin-bottom);
156+
}
157+
158+
.root[gap-width="large"][layout="inline"]:not([repeat]) .item:not(:last-child) {
155159
margin-right: var(--space-large);
156160
}
157161
158-
.root[gap-width="none"][layout="inline"] .item:not(:last-child) {
162+
.root[gap-width="none"][layout="inline"]:not([repeat]) .item:not(:last-child) {
159163
margin-right: var(--form-item-margin-bottom-none);
160164
}
161165
@@ -167,12 +171,17 @@ export default {
167171
margin-bottom: var(--form-item-margin-bottom-none);
168172
}
169173
170-
.root[gap-width="small"][layout="inline"] .item:not(:last-child) {
174+
.root[gap-width="small"][layout="inline"]:not([repeat]) .item:not(:last-child) {
171175
margin-right: var(--space-small);
172176
}
173177
174-
.root[gap-width="small"][layout="inline"] .item > .item_label {
178+
/* 会导致label样式错乱 先去掉了 */
179+
/* .root[layout="inline"][gap-width="small"]:not([repeat]) .item > .item_label {
175180
padding-right: var(--space-small);
181+
} */
182+
183+
.root[gap-width="normal"][layout="inline"]:not([repeat]) .item:not(:last-child) {
184+
margin-right: var(--space-medium);
176185
}
177186
178187
</style>

0 commit comments

Comments
 (0)