mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 02:00:25 +08:00
perf: Add the style injection of the top row to the form. (#102)
Co-authored-by: NorthLan <lan6995@gmail.com>
This commit is contained in:
parent
dc09de1e05
commit
b9d3d60e0f
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<Form v-bind="{ ...$attrs, ...$props }" ref="formElRef" :model="formModel">
|
||||
<Row :class="getProps.compact ? 'compact-form-row' : ''">
|
||||
<Row :class="getProps.compact ? 'compact-form-row' : ''" :style="getRowWrapStyleRef">
|
||||
<slot name="formHeader" />
|
||||
<template v-for="schema in getSchema" :key="schema.field">
|
||||
<FormItem
|
||||
@ -71,6 +71,11 @@
|
||||
const schemaRef = ref<Nullable<FormSchema[]>>(null);
|
||||
const formElRef = ref<Nullable<FormActionType>>(null);
|
||||
|
||||
const getRowWrapStyleRef = computed((): any => {
|
||||
const { baseRowStyle } = unref(getProps);
|
||||
return baseRowStyle || {};
|
||||
});
|
||||
|
||||
const getMergePropsRef = computed(
|
||||
(): FormProps => {
|
||||
return deepMerge(cloneDeep(props), unref(propsRef));
|
||||
@ -207,6 +212,7 @@
|
||||
getActionPropsRef,
|
||||
defaultValueRef,
|
||||
advanceState,
|
||||
getRowWrapStyleRef,
|
||||
getProps,
|
||||
formElRef,
|
||||
getSchema,
|
||||
|
@ -28,6 +28,9 @@ export const basicProps = {
|
||||
type: Object as PropType<any>,
|
||||
default: null,
|
||||
},
|
||||
baseRowStyle: {
|
||||
type: Object as PropType<any>,
|
||||
},
|
||||
baseColProps: {
|
||||
type: Object as PropType<any>,
|
||||
},
|
||||
|
@ -53,6 +53,9 @@ export interface FormProps {
|
||||
// Col configuration for the entire form
|
||||
wrapperCol?: Partial<ColEx>;
|
||||
|
||||
// General row style
|
||||
baseRowStyle?: object;
|
||||
|
||||
// General col configuration
|
||||
baseColProps?: Partial<ColEx>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user