forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(input-number): add keyboard prop to support disable keyboard (an…
- Loading branch information
Showing
5 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
order: 5 | ||
title: | ||
zh-CN: 键盘行为 | ||
en-US: Keyboard | ||
--- | ||
|
||
## zh-CN | ||
|
||
使用 `keyboard` 属性可以控制键盘行为。 | ||
|
||
## en-US | ||
|
||
Control keyboard behavior by `keyboard`. | ||
|
||
```jsx | ||
import { InputNumber, Button } from 'antd'; | ||
|
||
class App extends React.Component { | ||
state = { | ||
keyboard: true, | ||
}; | ||
|
||
toggle = () => { | ||
this.setState({ | ||
keyboard: !this.state.keyboard, | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<> | ||
<InputNumber min={1} max={10} keyboard={this.state.keyboard} defaultValue={3} /> | ||
<div style={{ marginTop: 20 }}> | ||
<Button onClick={this.toggle} type="primary"> | ||
Toggle keyboard | ||
</Button> | ||
</div> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
ReactDOM.render(<App />, mountNode); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters