@form-create/vant-designer
Version:
基于Vant的移动端低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
125 lines (123 loc) • 3.85 kB
JavaScript
import {localeOptions} from '../../utils';
export default function form({t}) {
return [
{
type: 'input',
field: 'formCreateFormName',
value: '',
title: t('form.formName'),
}, {
type: 'select',
field: 'labelAlign',
title: t('form.labelAlign'),
options: localeOptions(t, [
{
label: 'center',
value: 'center',
},
{
label: 'left',
value: 'left',
},
{
label: 'right',
value: 'right',
},
{
label: 'top',
value: 'top',
},
])
}, {
type: 'radio',
field: 'inputAlign',
title: t('form.inputAlign'),
options: localeOptions(t, [
{
label: 'left',
value: 'left',
},
{
label: 'center',
value: 'center',
},
{
label: 'right',
value: 'right',
},
])
},
{
type: 'SizeInput',
field: 'labelWidth',
title: t('form.labelWidth'),
},
{
type: 'switch',
field: 'colon',
title: t('form.colon'),
}, {
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: 'formCreate_event',
name: 'event',
warning: 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>'}),
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: 'beforeSubmit',
info: t('form.beforeSubmit'),
args: ['formData', 'data'],
},
{
name: 'beforeFetch',
info: t('form.beforeFetch'),
args: ['config', 'data'],
},
]
},
title: t('form.event'),
},
];
}