mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 19:19:26 +08:00
6776bb8916
* docs: update demo * chore: add script * test: fix demo test * docs: convert demos * chore: move script * test: remove react-dom import * chore: update deps * docs: update riddle js * test: fix image test * docs: fix riddle demo
78 lines
1.6 KiB
Markdown
78 lines
1.6 KiB
Markdown
---
|
|
order: 3
|
|
title:
|
|
zh-CN: 不可用状态
|
|
en-US: Disabled
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
添加 `disabled` 属性即可让按钮处于不可用状态,同时按钮样式也会改变。
|
|
|
|
## en-US
|
|
|
|
To mark a button as disabled, add the `disabled` property to the `Button`.
|
|
|
|
```jsx
|
|
import { Button } from 'antd';
|
|
|
|
export default () => (
|
|
<>
|
|
<Button type="primary">Primary</Button>
|
|
<Button type="primary" disabled>
|
|
Primary(disabled)
|
|
</Button>
|
|
<br />
|
|
<Button>Default</Button>
|
|
<Button disabled>Default(disabled)</Button>
|
|
<br />
|
|
<Button type="dashed">Dashed</Button>
|
|
<Button type="dashed" disabled>
|
|
Dashed(disabled)
|
|
</Button>
|
|
<br />
|
|
<Button type="text">Text</Button>
|
|
<Button type="text" disabled>
|
|
Text(disabled)
|
|
</Button>
|
|
<br />
|
|
<Button type="link">Link</Button>
|
|
<Button type="link" disabled>
|
|
Link(disabled)
|
|
</Button>
|
|
<br />
|
|
<Button danger>Danger Default</Button>
|
|
<Button danger disabled>
|
|
Danger Default(disabled)
|
|
</Button>
|
|
<br />
|
|
<Button danger type="text">
|
|
Danger Text
|
|
</Button>
|
|
<Button danger type="text" disabled>
|
|
Danger Text(disabled)
|
|
</Button>
|
|
<br />
|
|
<Button type="link" danger>
|
|
Danger Link
|
|
</Button>
|
|
<Button type="link" danger disabled>
|
|
Danger Link(disabled)
|
|
</Button>
|
|
<div className="site-button-ghost-wrapper">
|
|
<Button ghost>Ghost</Button>
|
|
<Button ghost disabled>
|
|
Ghost(disabled)
|
|
</Button>
|
|
</div>
|
|
</>
|
|
);
|
|
```
|
|
|
|
```css
|
|
.site-button-ghost-wrapper {
|
|
padding: 8px 8px 0 8px;
|
|
background: rgb(190, 200, 200);
|
|
}
|
|
```
|