🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### 方法 文本控件实例: ```php $text= $formControl->text(); ``` 设置控件标签: ```php $text->label('文本'); ``` 设置站位提示: ```php $text->placeholder('请输入关键词'); ``` 设置默认值: ```php $text->defaultValue(''); ``` 设置为必填: ```php $text->required(true); ``` 设置注释文本: ```php $text->comment('这里是一个注释文本'); ``` 设置栅栏布局 (默认:12`): ```php $text->layout(6); ``` 设置ui类: ```php $text->uiClass(['f13']); ``` 设置style样式: ```php $text->style(); ``` 设置html属性: ```php $text->attribute(); ``` ### 链式调用 ~~~ $formBuilder->setFormControl([ 'a' => $this->formControl->text()->label('普通文本'), ]) ~~~ ### 代码示例 ~~~ 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(); } } ~~~