Skip to content

Commit 1982a14

Browse files
authoredMar 18, 2022
style(SearchSelect): 样式调整,下拉菜单比搜索框长 #652 (#689)
1 parent 849b22f commit 1982a14

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed
 

‎packages/react-search-select/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const Demo = () => {
5151
<Row>
5252
<SearchSelect
5353
mode="multiple"
54-
style={{ width: 176 }}
54+
style={{ width: 200 }}
5555
showSearch={true}
5656
labelInValue={true}
5757
maxTagCount={6}
@@ -72,7 +72,7 @@ const Demo = () => {
7272
<Row>
7373
<SearchSelect
7474
mode="single"
75-
style={{ width: 176 }}
75+
style={{ width: 200 }}
7676
showSearch={true}
7777
labelInValue={true}
7878
maxTagCount={6}
@@ -196,12 +196,12 @@ const Demo = () => {
196196
>
197197
{({ fields, state, canSubmit }) => {
198198
return (
199-
<div>
200-
<Row gutter={20}>
201-
<Col fixed>{fields.selectField}</Col>
199+
<div style={{ marginLeft:10}}>
200+
<Row >
201+
<Col fixed style={{width:200}}>{fields.selectField}</Col>
202202
</Row>
203-
<Row gutter={20}>
204-
<Col fixed>{fields.selectSingle}</Col>
203+
<Row>
204+
<Col fixed style={{width:200}}>{fields.selectSingle}</Col>
205205
</Row>
206206
<Row>
207207
<Col fixed>

‎packages/react-search-select/src/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ export default function SearchSelect(props: SearchSelectProps) {
209209
className={cls}
210210
trigger="click"
211211
style={{ marginTop: 5 }}
212+
overlayStyl={{ width: 100 }}
212213
disabled={option && option.length > 0 ? false : true}
213214
{...others}
214215
onVisibleChange={onVisibleChange}
@@ -219,9 +220,9 @@ export default function SearchSelect(props: SearchSelectProps) {
219220
style={{
220221
minHeight: 25,
221222
maxHeight: 280,
222-
minWidth: 200,
223+
minWidth: style?.width ?? 200,
223224
overflowY: 'scroll',
224-
width: divRef.current ? divRef.current.offsetWidth : 'auto',
225+
width: style?.width,
225226
}}
226227
>
227228
{!option || option.length === 0 ? (

0 commit comments

Comments
 (0)
Please sign in to comment.