|
|
@ -7,6 +7,7 @@ let defaultTop: number;
|
|
|
|
let messageInstance: any;
|
|
|
|
let messageInstance: any;
|
|
|
|
let key = 1;
|
|
|
|
let key = 1;
|
|
|
|
let prefixCls = 'ant-message';
|
|
|
|
let prefixCls = 'ant-message';
|
|
|
|
|
|
|
|
let transitionName = 'move-up';
|
|
|
|
let getContainer: () => HTMLElement;
|
|
|
|
let getContainer: () => HTMLElement;
|
|
|
|
|
|
|
|
|
|
|
|
function getMessageInstance(callback: (i: any) => void) {
|
|
|
|
function getMessageInstance(callback: (i: any) => void) {
|
|
|
@ -16,7 +17,7 @@ function getMessageInstance(callback: (i: any) => void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Notification.newInstance({
|
|
|
|
Notification.newInstance({
|
|
|
|
prefixCls,
|
|
|
|
prefixCls,
|
|
|
|
transitionName: 'move-up',
|
|
|
|
transitionName,
|
|
|
|
style: { top: defaultTop }, // 覆盖原来的样式
|
|
|
|
style: { top: defaultTop }, // 覆盖原来的样式
|
|
|
|
getContainer,
|
|
|
|
getContainer,
|
|
|
|
}, (instance: any) => {
|
|
|
|
}, (instance: any) => {
|
|
|
@ -81,6 +82,7 @@ export interface ConfigOptions {
|
|
|
|
duration?: number;
|
|
|
|
duration?: number;
|
|
|
|
prefixCls?: string;
|
|
|
|
prefixCls?: string;
|
|
|
|
getContainer?: () => HTMLElement;
|
|
|
|
getContainer?: () => HTMLElement;
|
|
|
|
|
|
|
|
transitionName?: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
@ -117,6 +119,10 @@ export default {
|
|
|
|
if (options.getContainer !== undefined) {
|
|
|
|
if (options.getContainer !== undefined) {
|
|
|
|
getContainer = options.getContainer;
|
|
|
|
getContainer = options.getContainer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.transitionName !== undefined) {
|
|
|
|
|
|
|
|
transitionName = options.transitionName;
|
|
|
|
|
|
|
|
messageInstance = null; // delete messageInstance for new transitionName
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
destroy() {
|
|
|
|
destroy() {
|
|
|
|
if (messageInstance) {
|
|
|
|
if (messageInstance) {
|
|
|
|