UNPKG

@form-create/element-ui

Version:

Element Plus 版本低代码表单 | FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持多个 UI 框架,适配移动端,并且支持生成任何 Vue 组件。内置 20 种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。

32 lines (28 loc) • 890 B
import {creatorFactory} from '@form-create/core/src/index'; const DEFAULT_FORMATS = { date: 'YYYY-MM-DD', month: 'YYYY-MM', week: 'YYYY-wo', datetime: 'YYYY-MM-DD HH:mm:ss', timerange: 'HH:mm:ss', daterange: 'YYYY-MM-DD', monthrange: 'YYYY-MM', datetimerange: 'YYYY-MM-DD HH:mm:ss', year: 'YYYY' }; const name = 'datePicker'; export default { name, maker: (function () { return ['year', 'month', 'date', 'dates', 'week', 'datetime', 'datetimeRange', 'dateRange', 'monthRange'].reduce((initial, type) => { initial[type] = creatorFactory(name, {type: type.toLowerCase()}); return initial }, {}); }()), mergeProp(ctx) { const props = ctx.prop.props; if (!props.valueFormat) { props.valueFormat = DEFAULT_FORMATS[props.type] || DEFAULT_FORMATS['date']; } } }