Merge pull request #677 from lcx960324/2.0

bugfix on Message
This commit is contained in:
Aresn 2017-04-17 09:43:39 +08:00 committed by GitHub
commit ab249f7059
3 changed files with 11 additions and 2 deletions

View file

@ -3,6 +3,7 @@
<i-button @click.native="success">显示成功提示</i-button>
<i-button @click.native="warning">显示警告提示</i-button>
<i-button @click.native="error">显示错误提示</i-button>
<i-button @click.native="destroy">销毁提示</i-button>
</div>
</template>
<script>
@ -16,6 +17,9 @@
},
error () {
this.$Message.error('对方不想说话,并且向你抛出了一个异常');
},
destroy () {
this.$Message.destroy();
}
}
}

View file

@ -29,7 +29,10 @@ Notification.newInstance = properties => {
},
component: notification,
destroy () {
document.body.removeChild(div);
notification.closeAll();
setTimeout(function() {
document.body.removeChild(document.getElementsByClassName('ivu-message')[0].parentElement);
}, 500);
}
};
};

View file

@ -81,13 +81,15 @@
},
close (name) {
const notices = this.notices;
for (let i = 0; i < notices.length; i++) {
if (notices[i].name === name) {
this.notices.splice(i, 1);
break;
}
}
},
closeAll () {
this.notices = [];
}
}
};