feat(form,design): 一行多个表单默认右靠齐label

This commit is contained in:
manmanyu 2026-07-23 08:44:10 +00:00 committed by roymondchen
parent 11bf037054
commit 48abab7051
3 changed files with 8 additions and 3 deletions

View File

@ -48,11 +48,11 @@ const uiComponent = ui?.component || 'el-form-item';
const adapterType = getDesignConfig('adapterType');
const formInline = inject<boolean>('formInline');
const formInRow = inject<boolean>('isInRow');
const uiProps = computed<FormItemProps>(() => {
const { extra, extraTips, ...rest } = ui?.props(props) || props;
if (isGlobalFlat.value && rest.labelPosition === undefined) {
return { ...rest, labelPosition: formInline ? 'right' : 'left' };
return { ...rest, labelPosition: formInline || formInRow ? 'right' : 'left' };
}
return rest;
});

View File

@ -12,6 +12,7 @@
:disabled="disabled"
@change="changeHandler"
@add-diff-count="onAddDiffCount"
:is-in-row="true"
></Container>
</TMagicCol>
</template>

View File

@ -240,7 +240,7 @@
</template>
<script setup lang="ts">
import { computed, inject, readonly, ref, toRaw, watch, watchEffect } from 'vue';
import { computed, inject, provide, readonly, ref, toRaw, watch, watchEffect } from 'vue';
import { ArrowDown, ArrowUp, WarningFilled } from '@element-plus/icons-vue';
import { isEqual } from 'lodash-es';
@ -287,6 +287,8 @@ const props = withDefaults(
size?: string;
/** 是否开启对比模式 */
isCompare?: boolean;
/** 是否在行容器中 */
isInRow?: boolean;
}>(),
{
prop: '',
@ -476,6 +478,8 @@ watch(
},
);
provide('isInRow', props.isInRow ?? false);
const expandHandler = () => (expand.value = !expand.value);
const key = (config: any) => config[mForm?.keyProps];