mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
refactor(form): type component需要配置component
This commit is contained in:
parent
4313ddca54
commit
8aaf941d24
@ -229,14 +229,7 @@ import { isEqual } from 'lodash-es';
|
|||||||
|
|
||||||
import { TMagicButton, TMagicFormItem, TMagicIcon, TMagicTooltip } from '@tmagic/design';
|
import { TMagicButton, TMagicFormItem, TMagicIcon, TMagicTooltip } from '@tmagic/design';
|
||||||
|
|
||||||
import type {
|
import type { ChildConfig, ContainerChangeEventData, ContainerCommonConfig, FormState, FormValue } from '../schema';
|
||||||
ChildConfig,
|
|
||||||
ContainerChangeEventData,
|
|
||||||
ContainerCommonConfig,
|
|
||||||
FormState,
|
|
||||||
FormValue,
|
|
||||||
TypeFunction,
|
|
||||||
} from '../schema';
|
|
||||||
import { display as displayFunction, filterFunction, getRules } from '../utils/form';
|
import { display as displayFunction, filterFunction, getRules } from '../utils/form';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@ -307,7 +300,7 @@ const itemProp = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const tagName = computed(() => {
|
const tagName = computed(() => {
|
||||||
if (type.value === 'component') {
|
if (type.value === 'component' && props.config.component) {
|
||||||
return props.config.component;
|
return props.config.component;
|
||||||
}
|
}
|
||||||
return `m-${items.value ? 'form' : 'fields'}-${type.value}`;
|
return `m-${items.value ? 'form' : 'fields'}-${type.value}`;
|
||||||
@ -325,7 +318,7 @@ const rule = computed(() => getRules(mForm, props.config.rules, props));
|
|||||||
|
|
||||||
const type = computed((): string => {
|
const type = computed((): string => {
|
||||||
let { type } = props.config;
|
let { type } = props.config;
|
||||||
type = type && (filterFunction<string | TypeFunction>(mForm, type, props) as string);
|
type = type && filterFunction<string>(mForm, type, props);
|
||||||
if (type === 'form') return '';
|
if (type === 'form') return '';
|
||||||
if (type === 'container') return '';
|
if (type === 'container') return '';
|
||||||
return type?.replace(/([A-Z])/g, '-$1').toLowerCase() || (items.value ? '' : 'text');
|
return type?.replace(/([A-Z])/g, '-$1').toLowerCase() || (items.value ? '' : 'text');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user