🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### 方法 文本域控件实例: ```php $textarea= $formControl->textarea(); ``` 设置控件标签: ```php $textarea->label('textarea'); ``` 设置行数:`默认 3` 行 ```php $textarea->rows(5); ``` 设置站位提示: ```php $textarea->placeholder('请输入关键词'); ``` 设置默认值: ```php $textarea->defaultValue(''); ``` 设置为必填: ```php $textarea->required(true); ``` 设置注释文本: ```php $textarea->comment('这里是一个注释文本'); ``` 设置栅栏布局 (默认:12`): ```php $textarea->layout(6); ``` 设置ui类: ```php $textarea->uiClass(['f13']); ``` 设置style样式: ```php $textarea->style(); ``` 设置html属性: ```php $textarea->attribute(); ``` ### 链式调用 ~~~ $formBuilder->setFormControl([ 'j' => $this->formControl->textarea()->label('文本域')->required()->defaultValue('卧槽我\r\n卧槽"\'' . PHP_EOL), ]) ~~~ ### 代码示例 ~~~ public function actionAdd() { if ($this->isPost) { // return $this->as403('登录已失效!'); return $this->asOk('删除成功!'); // return $this->asFail('删除失败, 参数错误!'); } else { $get = $this->filteredGet; $viewBuilder = $this->viewBuilder; $viewBuilder->setPartial(); $form = $viewBuilder->form; $form->registerPointcut(H5::alert('我是表单切点', 'info', ['class' => ['mb-0']])) ->setFormControl([ 'j' => $this->formControl->textarea()->label('文本域')->required()->defaultValue('卧槽我\r\n卧槽"\'' . PHP_EOL), 'k' => $this->formControl->checkbox()->defaultValue(['a'])->options(['a' => '我', 'b' => '是', 'c' => '神',])->required()->label('标签')->tag(), 'l' => $this->formControl->checkbox()->defaultValue(['e', 'f'])->options(['d' => '我', 'e' => '是', 'f' => '神',])->required()->label('多选'), 'm' => $this->formControl->sw()->label('开关')->required()->checked(), 'n' => $this->formControl->hidden()->defaultValue('冲冲冲'), 'o' => $this->formControl->password()->label('密码')->required()->defaultValue('123456'), 'p' => $this->formControl->radio()->options(['g' => '我', 'h' => '是', 'i' => '神',])->defaultValue('h')->required()->label('单选'), 'q' => $this->formControl->range()->required()->label('范围')->defaultValue(1), ]) ->setCloseBtn() ->setSubmitBtn() ->setSubmittedCalls([ 'parent' => isset($get['_bid']) ? $get['_bid'] : null, ]) ->setAutoClose(true); return $viewBuilder->render(); } } ~~~