2021-01-29 14:35:05 +08:00
|
|
|
---
|
|
|
|
order: 5
|
|
|
|
title:
|
|
|
|
zh-CN: 键盘行为
|
|
|
|
en-US: Keyboard
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
使用 `keyboard` 属性可以控制键盘行为。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Control keyboard behavior by `keyboard`.
|
|
|
|
|
2021-02-22 22:07:19 +08:00
|
|
|
```tsx
|
|
|
|
import { InputNumber, Checkbox, Space } from 'antd';
|
|
|
|
|
|
|
|
const App = () => {
|
|
|
|
const [keyboard, setKeyboard] = React.useState(true);
|
|
|
|
return (
|
|
|
|
<Space>
|
|
|
|
<InputNumber min={1} max={10} keyboard={keyboard} defaultValue={3} />
|
|
|
|
<Checkbox
|
|
|
|
onChange={() => {
|
|
|
|
setKeyboard(!keyboard);
|
|
|
|
}}
|
|
|
|
checked={keyboard}
|
|
|
|
>
|
|
|
|
Toggle keyboard
|
|
|
|
</Checkbox>
|
|
|
|
</Space>
|
|
|
|
);
|
|
|
|
};
|
2021-01-29 14:35:05 +08:00
|
|
|
|
2022-04-15 16:20:56 +08:00
|
|
|
export default App;
|
2021-01-29 14:35:05 +08:00
|
|
|
```
|