UNPKG

@form-create/element-ui

Version:

element-ui动态表单|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 5 UI frameworks, and supports the generation of any Vue components. Built-in 20 ki

31 lines (27 loc) 869 B
import {creatorFactory} from '@form-create/core/src/index'; const DEFAULT_FORMATS = { date: 'YYYY-MM-DD', month: 'YYYY-MM', 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']; } } }