element-ui中的notify没有设置每次弹出的时间间隔,如果前端的点击事件不加以控制的话,会一直弹出多个notify。在API中notify有一个close()方法,利用这个可以控制每次只会弹出一个notify。
效果
notify() {
if(this.notifyInstance) {
this.notifyInstance.close();
}
this.notifyInstance=this.$notify({
title: '警告',
message: '这是一条警告的提示消息',
type: 'warning'
});
}
网友评论