Commit b9d3d60e0f8fe1166a0addcc8295365cbe65a7bf
Committed by
GitHub
1 parent
dc09de1e
perf: Add the style injection of the top row to the form. (#102)
Co-authored-by: NorthLan <lan6995@gmail.com>
Showing
3 changed files
with
13 additions
and
1 deletions
src/components/Form/src/BasicForm.vue
1 | 1 | <template> |
2 | 2 | <Form v-bind="{ ...$attrs, ...$props }" ref="formElRef" :model="formModel"> |
3 | - <Row :class="getProps.compact ? 'compact-form-row' : ''"> | |
3 | + <Row :class="getProps.compact ? 'compact-form-row' : ''" :style="getRowWrapStyleRef"> | |
4 | 4 | <slot name="formHeader" /> |
5 | 5 | <template v-for="schema in getSchema" :key="schema.field"> |
6 | 6 | <FormItem |
... | ... | @@ -71,6 +71,11 @@ |
71 | 71 | const schemaRef = ref<Nullable<FormSchema[]>>(null); |
72 | 72 | const formElRef = ref<Nullable<FormActionType>>(null); |
73 | 73 | |
74 | + const getRowWrapStyleRef = computed((): any => { | |
75 | + const { baseRowStyle } = unref(getProps); | |
76 | + return baseRowStyle || {}; | |
77 | + }); | |
78 | + | |
74 | 79 | const getMergePropsRef = computed( |
75 | 80 | (): FormProps => { |
76 | 81 | return deepMerge(cloneDeep(props), unref(propsRef)); |
... | ... | @@ -207,6 +212,7 @@ |
207 | 212 | getActionPropsRef, |
208 | 213 | defaultValueRef, |
209 | 214 | advanceState, |
215 | + getRowWrapStyleRef, | |
210 | 216 | getProps, |
211 | 217 | formElRef, |
212 | 218 | getSchema, | ... | ... |
src/components/Form/src/props.ts
src/components/Form/src/types/form.ts