form-tdesigner
Version:
好用的Vue低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
61 lines (58 loc) • 1.66 kB
JavaScript
import uniqueId from '@form-create/utils/lib/unique';
import {localeOptions, localeProps} from '../../utils';
const label = '输入框';
const name = 'input';
export default {
menu: 'main',
icon: 'icon-input',
label,
name,
event: ['blur', 'focus', 'change', 'input', 'clear'],
validate: ['string', 'url', 'email'],
rule({t}) {
return {
type: name,
field: uniqueId(),
title: t('com.input.name'),
info: '',
$required: false,
props: {}
};
},
props(_, {t}) {
return localeProps(t, name + '.props', [
{
type: 'switch',
field: 'disabled'
},
{
type: 'switch',
field: 'readonly'
},
{
type: 'select',
field: 'type',
options: localeOptions(t, [
{label: 'text', value: 'text'},
{label: 'number', value: 'number'},
{label: 'password', value: 'password'},
{label: 'search', value: 'search'},
{label: 'submit', value: 'submit'},
])
},
{
type: 'inputNumber',
field: 'maxlength',
props: {min: 0}
},
{
type: 'input',
field: 'placeholder'
},
{
type: 'switch',
field: 'clearable'
},
]);
}
};