form-tdesigner
Version:
好用的Vue低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
129 lines (127 loc) • 3.05 kB
JavaScript
import { localeOptions } from '../../utils';
export default function form({ t }) {
return [
{
type: 'input',
field: '>formName',
value: '',
title: t('form.formName'),
},
{
type: 'radio',
field: 'labelAlign',
value: 'left',
title: t('form.labelAlign'),
options: localeOptions(t, [
{ value: 'left', label: 'left' },
{ value: 'right', label: 'right' },
{ value: 'top', label: 'top' },
]),
},
{
type: 'input',
field: 'labelSuffix',
value: '',
title: t('form.labelSuffix'),
style: {
width: '150px',
},
},
{
type: 'SizeInput',
field: 'labelWidth',
value: '125px',
title: t('form.labelWidth'),
},
{
type: 'switch',
field: 'requiredMark',
value: false,
title: t('form.requiredMark'),
},
{
type: 'switch',
field: 'showErrorMessage',
value: true,
title: t('form.showErrorMessage'),
},
{
type: 'switch',
field: 'inlineMessage',
value: false,
title: t('form.inlineMessage'),
},
{
type: 'switch',
field: '_submitBtn>show',
value: true,
title: t('form.submitBtn'),
},
{
type: 'switch',
field: '_resetBtn>show',
value: false,
title: t('form.resetBtn'),
},
{
type: 'FnConfig',
field: '>_event',
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/global-event" style="color: inherit;text-decoration: underline;">' +
t('form.document') +
'</a>',
}),
rawContent: true,
},
value: {},
col: { show: true },
props: {
eventConfig: [
{
name: 'onSubmit',
info: t('form.onSubmit'),
args: ['formData', 'api'],
},
{
name: 'onReset',
info: t('form.onReset'),
args: ['api'],
},
{
name: 'onCreated',
info: t('form.onCreated'),
args: ['api'],
},
{
name: 'onMounted',
info: t('form.onMounted'),
args: ['api'],
},
{
name: 'onReload',
info: t('form.onReload'),
args: ['api'],
},
{
name: 'onChange',
info: t('form.onChange'),
args: ['field', 'value', 'options'],
},
{
name: 'beforeFetch',
info: t('form.beforeFetch'),
args: ['config', 'data'],
},
],
},
title: t('form.event'),
},
];
}