2018-12-26 22:34:29 +08:00
|
|
|
---
|
|
|
|
order: 11
|
|
|
|
title:
|
2019-05-07 14:57:32 +08:00
|
|
|
zh-CN: 带移除图标
|
|
|
|
en-US: With clear icon
|
2018-12-26 22:34:29 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
带移除图标的输入框,点击图标删除所有内容。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2019-06-18 19:08:36 +08:00
|
|
|
Input box with the remove icon, click the icon to delete everything.
|
2018-12-26 22:34:29 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2018-12-26 22:34:29 +08:00
|
|
|
import { Input } from 'antd';
|
2022-05-21 22:14:15 +08:00
|
|
|
import React from 'react';
|
2018-12-26 22:34:29 +08:00
|
|
|
|
2019-11-01 18:19:29 +08:00
|
|
|
const { TextArea } = Input;
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const onChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
2018-12-26 22:34:29 +08:00
|
|
|
console.log(e);
|
|
|
|
};
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2020-04-23 18:11:11 +08:00
|
|
|
<>
|
2019-11-01 18:19:29 +08:00
|
|
|
<Input placeholder="input with clear icon" allowClear onChange={onChange} />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<TextArea placeholder="textarea with clear icon" allowClear onChange={onChange} />
|
2022-04-03 23:27:45 +08:00
|
|
|
</>
|
2019-05-07 14:57:32 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|