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

35 lines
589 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
2019-05-07 14:57:32 +08:00
```jsx
2018-12-26 22:34:29 +08:00
import { Input } from 'antd';
const { TextArea } = Input;
2019-05-07 14:57:32 +08:00
const onChange = e => {
2018-12-26 22:34:29 +08:00
console.log(e);
};
ReactDOM.render(
<div>
<Input placeholder="input with clear icon" allowClear onChange={onChange} />
<br />
<br />
<TextArea placeholder="textarea with clear icon" allowClear onChange={onChange} />
</div>,
2019-05-07 14:57:32 +08:00
mountNode,
);
```