使用 我的应用 也是一种 支持 我的方式:
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

Input 输入框 === [![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-input/file/README.md) [![NPM Downloads](https://img.shields.io/npm/dm/@uiw/react-input.svg?style=flat)](https://www.npmjs.com/package/@uiw/react-input) [![npm version](https://img.shields.io/npm/v/@uiw/react-input.svg?label=@uiw/react-input)](https://npmjs.com/@uiw/react-input) 通过鼠标或键盘输入内容,是最基础的表单域的包装。 ```jsx import { Input } from 'uiw'; // or import Input from '@uiw/react-input'; ``` ### 基础用法 ```jsx mdx:preview&bg=#fff import React from 'react'; import { Input } from 'uiw'; export default function Demo() { return (
); } ``` ### 数字输入框 ```jsx mdx:preview&bg=#fff import React from 'react'; import { InputNumber, Row, Col } from 'uiw'; export default function Demo() { return (
限制大小 超出限界警告 设置步涨值
) }; ``` ### Form 中使用 Input ```jsx mdx:preview&bg=#fff import React from 'react'; import { Form, Input, InputNumber, Row, Col, Button, Notify } from 'uiw'; export default function Demo() { return (
{ }} onSubmitError={(error) => { console.log('error:', error) return error && error.filed ? { ...error.filed } : null; }} onSubmit={({initial, current}) => { if (current.input && current.input.length > 3) { Notify.success({ title: '提交成功!', description: `填写:【${current.input.toString()}】!` }); } else { Notify.error({ title: '提交失败!', description: '必须长度超过 3 个字符!' }); } const ErrObj = {}; if (current.input && current.input.length < 4) { ErrObj.input = '😆 必须长度超过 3 个字符!'; } if(Object.keys(ErrObj).length > 0) { const err = new Error(); err.filed = ErrObj; throw err; } }} fields={{ input: { value: 'www', label: '请输入内容', help: '必须长度超过 3 个字符!', validator: (value = '') => value.length < 4 ? '必填选项!' : null, children: , }, inputNumber: { value: 'www', label: '请输入内容', help: '必须长度超过 3 个字符!', validator: (value = '') => value.length < 4 ? '必填选项!' : null, children: , }, }} > {({ fields, state, canSubmit }) => { return (
{fields.input} {fields.inputNumber}
                  {JSON.stringify(state.current, null, 2)}
                
); }} ); } ``` ### 插入图标 ```jsx mdx:preview&bg=#fff import React from 'react'; import { Input, Row, Col } from 'uiw'; const stylItem = { margin: 20 }; export default function Demo() { return (
) } ``` ### 后面插入内容 向后面插入 [`Button`](#/components/button) 或者 [`Tag`](#/components/tag) ```jsx mdx:preview&bg=#fff import React from 'react'; import { Input, Row, Col, Button, Tag } from 'uiw'; export default function Demo() { return (
} /> } /> 按钮} /> 按钮} />
) } ``` ### 输入框尺寸 ```jsx mdx:preview&bg=#fff import React from 'react'; import { Input, Row, Col, Tag, Button } from 'uiw'; export default function Demo() { return (
} /> } /> 按钮} /> } /> 丸} /> } /> 按钮} /> 搜索} /> 按钮} /> 亮按钮} /> 按钮} /> 按钮} /> 按钮} />
) } ``` ### 密码输入框 ```jsx mdx:preview&bg=#fff import React from 'react'; import { Input, Row, Col, Button } from 'uiw'; class Demo extends React.Component { constructor() { super(); this.state = { btnIcon: 'lock', } } onClick() { this.setState({ btnIcon: this.state.btnIcon === 'lock' ? 'unlock' : 'lock', }) } render() { return ( { if (instance) { console.log('instance:', instance); } }} preIcon="like-o" type={this.state.btnIcon === 'lock' ? 'password' : 'text'} placeholder="请输入密码" addonAfter={