企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### xm-select插件文档地址 [xm-select插件文档](https://maplemei.gitee.io/xm-select) ### 方法 xselect下拉扩展实例: ```php $xselect = $formControl->xselect(); ``` 单选模式: `默认是 多选模式` ```php $xselect->radio(); ``` 是否重复选: `默认: false` ```php $xselect->repeat(); ``` 设置选择后,关闭选项框: ```php $xselect->clickClose(); ``` 超出自动换行: ```php $xselect->autoRow(); ``` 新增其他配置项: ```php $xselect->addPluginOption($filed, $value); ``` 是否开启分页:`默认 false` ```php $xselect->paging(true); ``` 是否开启工具栏:`默认 false` ```php $xselect->toolbar(true); ``` 开启搜索: ```php $xselect->filterable(); ``` 搜索延迟 ms: `默认 100` ```php $xselect->delay(200); ``` 搜索占位提示: ```php $xselect->searchTips('请输入搜索'); ``` 设置数据选项: * 参数 说明 类型 可选值 默认值 * name 显示名称 string - name * value 选中值, 当前多选唯一 string - value * selected 是否选中 string - selected * disabled 是否禁用 string - disabled * children 分组children string - children * optgroup 分组optgroup string - optgroup ```php $xselect->data([ ['name' => 'name1', 'value' => 1, 'children' => [ ['name' => 'name1-2', 'value' => 12, 'children' => []], ['name' => 'name1-3', 'value' => 13, 'children' => []], ['name' => 'name1-4', 'value' => 14, 'children' => []], ['name' => 'name1-5', 'value' => 15, 'children' => []], ['name' => 'name1-6', 'value' => 16, 'children' => []], ['name' => 'name1-7', 'value' => 17, 'children' => []], ]], ['name' => 'name2', 'value' => 2, 'children' => []], ['name' => 'name3', 'value' => 3, 'children' => []], ['name' => 'name4', 'value' => 4, 'children' => [ ['name' => 'name4-5', 'value' => 45, 'children' => []], ['name' => 'name4-6', 'value' => 46, 'children' => []], ['name' => 'name4-7', 'value' => 47, 'children' => []], ]], ['name' => 'name5', 'value' => 5, 'children' => []], ['name' => 'name6', 'value' => 6, 'children' => []], ['name' => 'name7', 'value' => 7, 'children' => []], ]); ``` 设置站位提示: ```php $xselect->tips('请选择'); ``` 设置默认值: ```php $xselect->defaultValue(0, 10); ``` 设置控件标签: ```php $xselect->label('区间'); ``` 设置为必填: ```php $xselect->required(true); ``` 设置注释文本: ```php $xselect->comment('这里是一个注释文本'); ``` 设置栅栏布局 (默认:12`): ```php $xselect->layout(6); ``` 设置ui类: ```php $sw->uiClass(['f13']); ``` 设置style样式: ```php $sw->style(); ``` 设置html属性: ```php $sw->attribute(); ``` ## 示例 ~~~ /** * @return string * @throws \yii\base\InvalidConfigException */ public function actionTree() { if ($this->isPost) { return $this->asOk('success'); } else { $formBuilder = FormBuilder::instance(); $formBuilder->setTitle('xm-select') ->setFormControl([ 'a' => $this->formControl->xselect()->label('xm-select')->defaultValue([1])->data($this->getData())->tips('请选择一哈!')->filterable()->radio()->clickClose(), 'd' => $this->formControl->xselectTree() ->label('xm-select-tree') ->defaultValue(['6']) ->data($this->getTreeData()) ->tips('请选择一哈!') ->filterable() //->radio() //->strict(false) ->expandedKeys(true) ->addPluginOption('height', '500px') /*->clickClose()*/, 'e' => $this->formControl->xselectRemote() ->label('xm-select-remote') ->tips('请选择一哈!') ->filterable() ->radio() ->clickClose() ->toolbar([ 'show' => true, ]) ->addPluginOption('tree', [ 'show' => true, ]) ->url(['form/remote']) ->httpMethod('get'), 'f' => $this->formControl->xselectCascader() ->label('xm-select-cascader') ->defaultValue(['6']) ->data($this->getTreeData()) ->tips('请选择一哈!') ->radio() ->clickClose() ->strict(false), 'g' => $this->formControl->file() ->label('测试一下') ->max(5) ->scenarioImage() ->scenarioVideo() ->scenarioAudio() ->scenarioOther() ->defaultValue('https://tfs.alipayobjects.com/images/partner/TB1TrI3cTVyDuNk6XeaXXXCWXXa'), ]) ->setResetBtn() ->setSubmitBtn(); return $formBuilder->render(); } } ~~~