mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
40 lines
672 B
Markdown
40 lines
672 B
Markdown
---
|
|
order: 5
|
|
title:
|
|
zh-CN: 键盘行为
|
|
en-US: Keyboard
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
使用 `keyboard` 属性可以控制键盘行为。
|
|
|
|
## en-US
|
|
|
|
Control keyboard behavior by `keyboard`.
|
|
|
|
```tsx
|
|
import { Checkbox, InputNumber, Space } from 'antd';
|
|
import React, { useState } from 'react';
|
|
|
|
const App: React.FC = () => {
|
|
const [keyboard, setKeyboard] = useState(true);
|
|
|
|
return (
|
|
<Space>
|
|
<InputNumber min={1} max={10} keyboard={keyboard} defaultValue={3} />
|
|
<Checkbox
|
|
onChange={() => {
|
|
setKeyboard(!keyboard);
|
|
}}
|
|
checked={keyboard}
|
|
>
|
|
Toggle keyboard
|
|
</Checkbox>
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
```
|