form-tdesigner
Version:
好用的Vue低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
51 lines (50 loc) • 1.64 kB
JavaScript
export default function field({t}) {
return [
{
type: 'FieldInput',
field: 'field',
value: '',
title: t('form.field'),
}, {
type: 'LanguageInput',
field: 'title',
value: '',
title: t('form.title'),
}, {
type: 'LanguageInput',
field: 'info',
value: '',
title: t('form.info'),
}, {
type: 'SizeInput',
field: 'formCreateWrap>labelWidth',
value: '',
title: t('form.labelWidth'),
}, {
type: 'Struct',
field: '_control',
name: 'control',
value: [],
title: t('form.control'),
info: {
type: 'tooltip',
native: true,
effect: 'dark',
placement: 'top-end',
align: 'left',
content: t('form.controlDocument', {doc: '<a target="_blank" href="https://form-create.com/v3/guide/control" style="color: inherit;text-decoration: underline;">' + t('form.document') + '</a>'}),
rawContent: true,
},
props: {
defaultValue: [],
validate(val) {
if (!Array.isArray(val)) return false;
if (!val.length) return true;
return !val.some(({rule}) => {
return !Array.isArray(rule);
});
}
}
},
];
}