|
|
@ -4,14 +4,17 @@ import Notification from 'rc-notification'; |
|
|
|
let defaultDuration = 1.5; |
|
|
|
let top; |
|
|
|
|
|
|
|
var messageInstance; |
|
|
|
|
|
|
|
function getMessageInstance() { |
|
|
|
return Notification.newInstance({ |
|
|
|
messageInstance = messageInstance || Notification.newInstance({ |
|
|
|
prefixCls: 'ant-message', |
|
|
|
transitionName: 'move-up', |
|
|
|
style: { |
|
|
|
top: top |
|
|
|
} // 覆盖原来的样式 |
|
|
|
}); |
|
|
|
return messageInstance; |
|
|
|
} |
|
|
|
|
|
|
|
function notice(content, duration = defaultDuration, type) { |
|
|
@ -21,7 +24,6 @@ function notice(content, duration = defaultDuration, type) { |
|
|
|
'error': 'anticon-exclamation-circle ant-message-error' |
|
|
|
})[type]; |
|
|
|
getMessageInstance().notice({ |
|
|
|
key: 'simpleMessage', |
|
|
|
duration: duration, |
|
|
|
style: {}, |
|
|
|
content: <div className="ant-message-custom-content"> |
|
|
|