天天看点

php table参数,数据表格(table)

>[danger] 友情提示:构建器目前只支持HisiPHP Pro版本([我要升级](https://www.hisiphp.com/authorize.html))

## 数据表格(table)

| 参数 | 类型 | 必须 | 默认 | 说明

| --- | --- | --- | --- | --- |

| type | string | Y | | 固定值:table |

| title | string | Y | | 标题 |

| cols | array | Y | | 设置表头,详见**表头参数**|

| data | array | N | | 初始数据 |

| del_url | string | N | | 删除时触发的链接 |

## 表头参数(cols)

| 参数 | 类型 | 必须 | 默认 | 说明

| --- | --- | --- | --- | --- |

| type | string | Y | | 固定值:text |

| title | string | Y | | 标题 |

| field | string | Y | | 字段名 |

| value | string/int | N | | 默认值 |

>[info]![](https://img.kancloud.cn/3d/0c/3d0cef5e3411d6554c689940abc61f86_1152x440.png)

>[]示例代码:

```

$assign['buildForm']['items'] = [

[

'type' => 'table',

'title' => '数据表格',

'name' => 'table',

'data' => [// 初始数据

[

'text' => '红色',

'color' => '#f00',

'image' => 'red.jpg',

],

[

'text' => '黑色',

'color' => '#000',

'image' => 'black.jpg',

],

],

'cols' => [//设置表头

[

'title' => '文字',// 标题

'type' => 'text',// 类型

'field' => 'text',// 字段名

],

[

'title' => '颜色',

'type' => 'text',

'field' => 'color',

],

[

'title' => '图片',

'type' => 'text',

'field' => 'image',

],

],

],

// 更多表单项.....

];

$this->assign($assign);

```