配置说明:
| 参数 |
类型 |
必须 |
默认 |
说明 |
| type |
string |
Y |
|
固定值:text |
| grid |
Array |
N |
[12, 12, 12, 12] |
栅格布局 |
| name |
string |
Y |
|
字段名称 |
| title |
string |
Y |
|
标题 |
| value |
string/int |
N |
|
定义默认值 |
| tips |
string |
N |
|
提示说明 |
| prefix |
string |
N |
|
表单前缀 |
| suffix |
string |
N |
|
表单后缀 |
| attrs |
array |
N |
|
文本框自定义属性 |
基础示例代码:
public function demo() { $assign['buildForm']['items'] = [ [ 'type' => 'text', 'title' => '用户名', 'name' => 'text', 'tips' => '用户名必须', 'attrs' => [ 'placeholder' => '请输入字母或数字', 'lay-verify' => 'required', ], ], // 更多表单项..... ]; return $this->assign($assign)->fetch(); }
基础示例渲染效果:

带前缀示例代码:
public function demo()
{
$assign['buildForm']['items'] = [
[
'type' => 'text',
'title' => '链接地址',
'name' => 'text',
'prefix' => 'http://',
'attrs' => [
'placeholder' => '请输入域名',
'lay-verify' => 'required',
],
],
// 更多表单项.....
];
return $this->assign($assign)->fetch();
}
带前缀示例渲染效果:

带后缀示例代码:
public function demo()
{
$assign['buildForm']['items'] = [
[
'type' => 'text',
'title' => '商品价格',
'name' => 'text',
'suffix' => '元',
'attrs' => [
'lay-verify' => 'required',
],
],
// 更多表单项.....
];
return $this->assign($assign)->fetch();
}
带后缀示例渲染效果:
