@@ -5,8 +5,8 @@ desc: 可对选项进行搜索
55---
66
77``` jsx
8- import React from ' react' ;
9- import { Select } from ' cloud-react' ;
8+ import React , { useState } from ' react' ;
9+ import { Select , Checkbox } from ' cloud-react' ;
1010
1111const Option = Select .Option ;
1212
@@ -54,6 +54,8 @@ const dataList = [
5454];
5555
5656export default function SelectDemo () {
57+ const [disabled , setDisabled ] = useState (false );
58+
5759 const handleChange = (value ) => {
5860 console .log (' select --- ' + value);
5961 };
@@ -64,11 +66,15 @@ export default function SelectDemo() {
6466
6567 return (
6668 < div style= {{ display: ' flex' , gap: 20 , flexDirection: ' column' }}>
69+ < Checkbox checked= {disabled} onChange= {checked => {
70+ setDisabled (checked)
71+ }}> 禁用< / Checkbox>
6772 < div>
6873 < h5> 搜索框在下拉框内(单选)< / h5>
6974 < Select
7075 searchable
7176 allowClear
77+ disabled= {disabled}
7278 supportLightText
7379 placeholder= " 带搜索的下拉单选"
7480 onSearch= {handleSearch}
@@ -86,6 +92,7 @@ export default function SelectDemo() {
8692 multiple
8793 searchable
8894 allowClear
95+ disabled= {disabled}
8996 supportLightText
9097 placeholder= " 带搜索的下拉单选"
9198 onSearch= {handleSearch}
@@ -101,6 +108,7 @@ export default function SelectDemo() {
101108 searchable
102109 searchInBox
103110 allowClear
111+ disabled= {disabled}
104112 supportLightText
105113 placeholder= " 带搜索的下拉单选"
106114 onSearch= {handleSearch}
@@ -117,6 +125,7 @@ export default function SelectDemo() {
117125 searchable
118126 searchInBox
119127 allowClear
128+ disabled= {disabled}
120129 multiple
121130 supportLightText
122131 placeholder= " 带搜索的下拉多选"
@@ -133,6 +142,7 @@ export default function SelectDemo() {
133142 searchable
134143 searchInBox
135144 allowClear
145+ disabled= {disabled}
136146 multiple
137147 supportLightText
138148 placeholder= " 带搜索的下拉多选"
0 commit comments