介绍
pipeline动态表单是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的表单生成器。支持基础表单的全部功能,。同时支持表单联动,系统接口调用等复杂场景,可以快速处理pipeline多种流水线组件配置。
安装
ramda
npm install ramda
内联组件
- input
- select
- radio
- checkbox
- switch
- 部分业务组件
快速上手
组件模式
<DynamicForm
ref="formCreate"
:normal-style="normalStyle"
:form-rule = "rule" />
- form-rule:动态表单数据格式
- ref
- normalStyle表单基础配置(长,宽等样式配置,没有使用默认值)
表单生成
```
// json规则
const rule = [
{
type: "select",
field: "cate_id",
title: "产品分类",
value: '',
api: {
url: '',
methods:'' // get post
},// 代理前缀及地址不需要返回
options: [
{"value": "104", "label": "生态蔬菜", "disabled": false},
{"value": "105", "label": "新鲜水果", "disabled": false},
],
props: { // 默认与mtd prop值相同
filterable: false, // 是否可搜索
remote-method:'',// 默认搜索必须远程,绑定方法,本地实现,非模糊查询时为空即可
clearable:false, // 是否可清空
remote: ture, //是否开启远程搜索
},
validate:[{type: "string", required: fasle, pattern: ".*"}] // 校验规则,
}
]
```