mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-07-25 07:28:23 +00:00
feat(form,design): 一行多个表单默认右靠齐label
This commit is contained in:
parent
11bf037054
commit
48abab7051
@ -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;
|
||||
});
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
:disabled="disabled"
|
||||
@change="changeHandler"
|
||||
@add-diff-count="onAddDiffCount"
|
||||
:is-in-row="true"
|
||||
></Container>
|
||||
</TMagicCol>
|
||||
</template>
|
||||
|
||||
@ -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];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user