@form-create/ant-design-vue
Version:
AntDesignVue版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。
22 lines (19 loc) • 725 B
JavaScript
import {creatorFactory} from '@form-create/core/src/index';
const name = 'input';
export default {
name,
maker: (function () {
return ['password', 'url', 'email', 'text', 'textarea', 'search'].reduce((maker, type) => {
maker[type] = creatorFactory(name, {type});
return maker;
}, {
idate: creatorFactory(name, {type:'date'})
});
}()),
render(children, ctx) {
let type = ctx.prop.props.type;
if (['textarea', 'search'].indexOf(type) === -1) type = 'input';
type = (type === 'textarea' ? 'ATextarea' : (type === 'search' ? 'AInputSearch' : 'AInput'));
return ctx.$render.vNode.make(type, ctx.prop, children);
}
}