ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 方法 滑块控件实例: ```php $range = $formControl->range(); ``` 设置最小值 (int):`默认 0` ```php $range->min(1); ``` 设置最大值 (int):`默认 100` ```php $range->max(50); ``` 设置步数 (int):`默认 1` ```php $range->step(2); ``` 设置控件标签: ```php $range->label('单选'); ``` 设置默认值: ```php $range->defaultValue('yes'); ``` 设置为必填: ```php $range->required(true); ``` 设置注释文本: ```php $range->comment('这里是一个注释文本'); ``` 设置栅栏布局 (默认:12`): ```php $range->layout(6); ``` 设置ui类: ```php $range->uiClass(['f13']); ``` 设置style样式: ```php $range->style(); ``` 设置html属性: ```php $range->attribute(); ``` ### 链式调用 ~~~ $formBuilder->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(''), ]) ~~~ ### 代码示例 ~~~ 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(); } } ~~~