多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 属性 (只写) `$formControl array 组控件项` ## 方法 设置组控件项: ```php $formBuilder->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), ]); // $this ``` ## 示例 ~~~ /** * @return string * @throws \ReflectionException * @throws \builder\base\UndefinedParamsException * @throws \yii\base\InvalidConfigException */ public function actionDynamicSelect() { if ($this->isPost) { return $this->asOk('提交成功'); } else { $formBuilder = FormBuilder::instance(); $formBuilder->setTitle('动态下拉框') ->setRequiredStyle() ->setFormControl([ 'a' => $this->formControl->text()->label('普通文本'), 'b' => $this->formControl->selectDynamic() ->label('动态下拉1') ->layout(12) ->required() ->placeholder('请填写一下') ->defaultValue(['F']) ->multiple() //->refreshBtn() //->refreshBtnPosition() ->additionBtn(function (DselectModal $modal) { return $modal->route('form/addition')->title('新增')->height(230); }) //->additionBtnPosition() ->dataUrl('form/link') ->comment(''), ]) ->setResetBtn() ->setSubmitBtn(); return $formBuilder->render(); } } ~~~