mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
parent
3639f048f5
commit
f3d4ccc045
@ -1,6 +1,6 @@
|
||||
# 可关闭的警告提示
|
||||
|
||||
- order: 1
|
||||
- order: 2
|
||||
|
||||
显示关闭按钮,点击可关闭警告提示。
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# 自定义关闭
|
||||
|
||||
- order: 4
|
||||
- order: 5
|
||||
|
||||
可以自定义关闭,自定义的文字会替换原先的关闭 `Icon`。
|
||||
|
||||
@ -11,5 +11,5 @@ import { Alert } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Alert message="消息提示的文案" type="info" closeText="不再提醒" />
|
||||
, document.getElementById('components-alert-demo-close-type'));
|
||||
, document.getElementById('components-alert-demo-close-text'));
|
||||
````
|
@ -1,6 +1,6 @@
|
||||
# 含有辅助性文字介绍
|
||||
|
||||
- order: 2
|
||||
- order: 3
|
||||
|
||||
含有辅助性文字介绍的警告提示。
|
||||
|
||||
|
36
components/alert/demo/icon.md
Normal file
36
components/alert/demo/icon.md
Normal file
@ -0,0 +1,36 @@
|
||||
# 图标
|
||||
|
||||
- order: 4
|
||||
|
||||
可口的图标让信息类型更加醒目。
|
||||
|
||||
---
|
||||
|
||||
````jsx
|
||||
import { Alert } from 'antd';
|
||||
|
||||
ReactDOM.render(<div>
|
||||
<Alert message="成功提示的文案" type="success" showIcon />
|
||||
<Alert message="消息提示的文案" type="info" showIcon />
|
||||
<Alert message="警告提示的文案" type="warn" showIcon />
|
||||
<Alert message="错误提示的文案" type="error" showIcon />
|
||||
<Alert message="成功提示的文案"
|
||||
description="成功提示的辅助性文字介绍成功提示的辅助性文字介绍成功提示的辅助性文字介绍成功提示的辅助性文字介绍"
|
||||
type="success"
|
||||
showIcon />
|
||||
<Alert message="消息提示的文案"
|
||||
description="消息提示的辅助性文字介绍消息提示的辅助性文字介绍消息提示的辅助性文字介绍"
|
||||
type="info"
|
||||
showIcon />
|
||||
<Alert
|
||||
message="警告提示的文案"
|
||||
description="警告提示的辅助性文字介绍警告提示的辅助性文字介绍"
|
||||
type="warn"
|
||||
showIcon />
|
||||
<Alert
|
||||
message="错误提示的文案"
|
||||
description="错误提示的辅助性文字介绍错误提示的辅助性文字介绍错误提示的辅助性文字介绍错误提示的辅助性文字介绍错误提示的辅助性文字介绍错误提示的辅助性文字介绍"
|
||||
type="error"
|
||||
showIcon />
|
||||
</div>, document.getElementById('components-alert-demo-icon'));
|
||||
````
|
@ -1,6 +1,6 @@
|
||||
# 四种样式
|
||||
|
||||
- order: 3
|
||||
- order: 1
|
||||
|
||||
共有四种样式`success`、`info`、`warn`、`error`。
|
||||
|
||||
|
@ -9,7 +9,6 @@ export default React.createClass({
|
||||
return {
|
||||
prefixCls: 'ant-alert',
|
||||
showIcon: false,
|
||||
closeText: <Icon type="cross" />,
|
||||
onClose() {}
|
||||
};
|
||||
},
|
||||
@ -40,7 +39,7 @@ export default React.createClass({
|
||||
},
|
||||
render() {
|
||||
let {
|
||||
closable, description, type, prefixCls, message, closeText
|
||||
closable, description, type, prefixCls, message, closeText, showIcon
|
||||
} = this.props;
|
||||
|
||||
let iconType = '';
|
||||
@ -66,6 +65,7 @@ export default React.createClass({
|
||||
[prefixCls + '-' + type]: true,
|
||||
[prefixCls + '-close']: !this.state.closing,
|
||||
[prefixCls + '-with-description']: !!description,
|
||||
[prefixCls + '-no-icon']: !showIcon,
|
||||
});
|
||||
|
||||
if (closeText) {
|
||||
@ -78,11 +78,11 @@ export default React.createClass({
|
||||
transitionName="slide-up"
|
||||
onEnd={this.animationEnd}>
|
||||
<div data-show={this.state.closing} className={alertCls}>
|
||||
<Icon className="ant-alert-icon" type={iconType} />
|
||||
{showIcon ? <Icon className="ant-alert-icon" type={iconType} /> : null}
|
||||
<span className={prefixCls + '-message'}>{message}</span>
|
||||
<span className={prefixCls + '-description'}>{description}</span>
|
||||
{closable ? <a onClick={this.handleClose} className={prefixCls + '-close-icon'}>
|
||||
{closeText}
|
||||
{closeText || <Icon type="cross" />}
|
||||
</a> : null}
|
||||
</div>
|
||||
</Animate>
|
||||
|
@ -23,3 +23,4 @@
|
||||
| message | 必选参数,警告提示内容 | String | 无 |
|
||||
| description | 可选参数,警告提示的辅助性文字介绍 | String | 无 |
|
||||
| onClose | 可选参数,关闭时触发的回调函数 | Function | 无 |
|
||||
| showIcon | 可选参数,是否显示辅助图标 | Boolean | false |
|
||||
|
@ -91,6 +91,10 @@
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
&-with-description&-no-icon {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
&-with-description &-icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
|
Loading…
Reference in New Issue
Block a user