ant-design/components/input/demo/allowClear.md

37 lines
691 B
Markdown
Raw Normal View History

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
```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
const { TextArea } = Input;
const onChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
2018-12-26 22:34:29 +08:00
console.log(e);
};
const App: React.FC = () => (
<>
<Input placeholder="input with clear icon" allowClear onChange={onChange} />
<br />
<br />
<TextArea placeholder="textarea with clear icon" allowClear onChange={onChange} />
</>
2019-05-07 14:57:32 +08:00
);
export default App;
2019-05-07 14:57:32 +08:00
```