配置说明:
| 参数 | 类型 | 必须 | 默认 | 说明 |
|---|---|---|---|---|
| type | string | Y | 固定值:table | |
| name | string | Y | 字段名称 | |
| title | string | Y | 标题 | |
| data | array | N | 定义默认数据 | |
| tips | string | N | 提示说明 | |
| cols | array | Y | 详见表头参数配置 | |
| addBtn | bool | N | true | 是否显示添加按钮 |
| delBtn | bool/string | N | true | 为false时隐藏删除按钮,为url地址时,显示删除按钮,点击删除按钮会自动通过ajax触发url |
cols 表头参数:
| 参数 | 类型 | 必须 | 默认 | 说明 |
|---|---|---|---|---|
| type | string | Y | 可选值:text、select、checkbox、radio、txt、html、image、file、hidden、textarea、year、month、date、time、datetime | |
| field | string | Y | 字段名称 | |
| title | string | Y | 标题 | |
| attrs | array | N | 自定义属性,详细属性可根据type查看对应的表单项文档 |
示例代码:
public function demo(){$assign['buildForm']['items'] = [['type' => 'table','title' => '表格','name' => 'table','delBtn' => url('delValue'),'data' => [['text' => '红色','color' => '#f00',],],'cols' => [['title' => '文字','type' => 'text','field' => 'text',],['title' => '颜色','type' => 'color','field' => 'color',],['title' => '图片','type' => 'image','field' => 'image',],],],// 更多表单项.....];return $this->assign($assign)->fetch();}
渲染效果:

