message components bug fixed
message components bug fixed
This commit is contained in:
parent
7c15ac9e31
commit
47e5839630
5 changed files with 25 additions and 8 deletions
|
@ -24,6 +24,9 @@ Notification.newInstance = properties => {
|
|||
notice (noticeProps) {
|
||||
notification.add(noticeProps);
|
||||
},
|
||||
remove (key) {
|
||||
notification.close(key);
|
||||
},
|
||||
component: notification,
|
||||
destroy () {
|
||||
document.body.removeChild(div);
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
},
|
||||
methods: {
|
||||
add (notice) {
|
||||
const key = getUuid();
|
||||
const key = notice.key || getUuid();
|
||||
|
||||
let _notice = Object.assign({
|
||||
style: {
|
||||
|
|
|
@ -2,11 +2,13 @@ import Notification from '../base/notification';
|
|||
|
||||
const prefixCls = 'ivu-message';
|
||||
const iconPrefixCls = 'ivu-icon';
|
||||
const prefixKey = 'ivu_message_key_';
|
||||
|
||||
let defaultDuration = 1.5;
|
||||
|
||||
let top;
|
||||
let messageInstance;
|
||||
let key = 1;
|
||||
|
||||
const iconTypes = {
|
||||
'info': 'information-circled',
|
||||
|
@ -42,6 +44,7 @@ function notice (content, duration = defaultDuration, type, onClose) {
|
|||
let instance = getMessageInstance();
|
||||
|
||||
instance.notice({
|
||||
key: `${prefixKey}${key}`,
|
||||
duration: duration,
|
||||
style: {},
|
||||
content: `
|
||||
|
@ -52,6 +55,15 @@ function notice (content, duration = defaultDuration, type, onClose) {
|
|||
`,
|
||||
onClose: onClose
|
||||
});
|
||||
|
||||
// 用于手动消除
|
||||
return (function () {
|
||||
let target = key++;
|
||||
|
||||
return function () {
|
||||
instance.remove(`${prefixKey}${target}`);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue