使用 我的应用 也是一种 支持 我的方式:
DockLift: 点击 Dock 应用窗口回到当前屏幕 Zipora: Zip/RAR/7Z 解压工具 Scap: Screenshot & Markup Edit Screen Test Deskmark Keyzer Vidwall Hub VidCrop Vidwall Mousio Hint Mousio Musicer Audioer FileSentinel FocusCursor Videoer KeyClicker DayBar Iconed Menuist Quick RSS Quick RSS Web Serve Copybook Generator DevTutor for SwiftUI RegexMate Time Passage Iconize Folder Textsound Saver Create Custom Symbols DevHub Resume Revise Palette Genius Symbol Scribe

Select 选择器 === [![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor) [![Telegram Channel](https://img.shields.io/badge/%20-Telegram-00618f.svg?logo=Telegram)](https://t.me/s/AwesomeMacApps) [![Follow On X](https://img.shields.io/badge/Follow%20on%20X-333333?logo=x&logoColor=white)](https://x.com/jaywcjlove) [![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-select/file/README.md) [![NPM Downloads](https://img.shields.io/npm/dm/@uiw/react-select.svg?style=flat)](https://www.npmjs.com/package/@uiw/react-select) [![npm version](https://img.shields.io/npm/v/@uiw/react-select.svg?label=@uiw/react-select)](https://npmjs.com/@uiw/react-select) 当选项过多时,使用下拉菜单展示并选择内容。 ```jsx import { Select } from 'uiw'; // or import Select from '@uiw/react-select'; ``` ### 基础用法 适用广泛的基础单选 `value` 的值为当前被选中的 `Option` 的 `value` 属性值。自定义 `Select` 请查看 [``](#/components/dropdown) 组件实例。 ```jsx mdx:preview&bg=#fff import React from 'react'; import { Row, Col, Select } from 'uiw'; export default function Demo() { return ( ); } ``` ### 禁用选择器 ```jsx mdx:preview&bg=#fff import React from 'react'; import { Row, Col, Select } from 'uiw'; export default function Demo() { return ( ); } ``` ### 尺寸 通过 `size` 属性设置选择器的尺寸,提供三个尺寸参数设置。 ```jsx mdx:preview&bg=#fff import React from 'react'; import { Row, Col, Select, Button } from 'uiw'; const rowSty = { marginBottom: 10 }; export default function Demo() { return (
); } ``` ### 选项组 ```jsx mdx:preview&bg=#fff import React from 'react'; import { Row, Col, Select } from 'uiw'; const Option = Select.Option; const Group = Select.Group; export default function Demo() { return ( ); } ``` ### 在表单中使用 在 [`
`](#/components/form) 表单中应用 [` Choose an item... One Two Three Four ) }, }} > {({ fields, state, canSubmit }) => { return (
{fields.selectField}
                    {JSON.stringify(state.current, null, 2)}
                  
) }}
) } ``` ### HTML select 这个组件是最简单的基础样式组件,可以直接引用样式,使用 `w-select` 纯样式即可达到效果,下拉框右边箭头效果通过样式更改,通过 [`b64`](http://b64.io/) 工具,转换成 `base64` 格式。 ```jsx import 'uiw/lib/esm/select/style/index.less'; ``` ```jsx mdx:preview&bg=#fff import React from 'react'; import { Row, Col, Select } from 'uiw'; export default function Demo() { return ( ); } ``` ## Select | 参数 | 说明 | 类型 | 默认值 | |--------- |-------- |--------- |-------- | | value | 控制时 `select` 的值必须与 `onChange` 函数一起使用才能更新 `select` 的值 | Any | - | | disabled | 禁用选择器 | Boolean | `false` | | defaultValue | 根据 `value` 进行比较,判断是否选中 | Any | - | | size | 选择框尺寸 | Enum {`large`, `default`, `small` } | `default` |