mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-06 02:38:00 +08:00
58df74c38e
* docs(badge): replace class component with hooks * docs(button): replace class component with hooks * docs(calendar): replace class component with hooks * docs(card): replace class component with hooks * docs(button): replace class component with hooks * chore(deps): remove webpack devDependencies * docs(cascader): replace class component with hooks * docs(checkbox): replace class component with hooks * docs(collapse): replace class component with hooks * docs(comment): replace class component with hooks * docs(descriptions): replace class component with hooks * docs(config-provider): replace class component with hooks * docs(date-picker): replace class component with hooks * docs(drawer): replace class component with hooks * docs(dropdown): replace class component with hooks * docs(dropdown): replace class component with hooks * docs(empty): replace class component with hooks * docs(grid): replace class component with hooks * docs(input): replace class component with hooks * docs(input-number): replace class component with hooks * docs(demo): fix lint error
38 lines
633 B
Markdown
38 lines
633 B
Markdown
---
|
|
order: 2
|
|
title:
|
|
zh-CN: 不可用
|
|
en-US: Disabled
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
点击按钮切换可用状态。
|
|
|
|
## en-US
|
|
|
|
Click the button to toggle between available and disabled states.
|
|
|
|
```jsx
|
|
import { InputNumber, Button } from 'antd';
|
|
|
|
export default () => {
|
|
const [disabled, setDisabled] = React.useState(true);
|
|
|
|
const toggle = () => {
|
|
setDisabled(!disabled);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<InputNumber min={1} max={10} disabled={disabled} defaultValue={3} />
|
|
<div style={{ marginTop: 20 }}>
|
|
<Button onClick={toggle} type="primary">
|
|
Toggle disabled
|
|
</Button>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
```
|