element ui v2,用js关闭MessageBox 弹框
问题
$alert(message, title, options)
或$alert(message, options)
$confirm(message, title, options)
或$confirm(message, options)
$prompt(message, title, options)
或$prompt(message, options)
这些返回的都是Promise的实例,所以无法直接操作,
正确食用方式是调用this.$msgbox.close();就可以关闭啦
文档是找不到这个说明滴~。~
前提
如果你完整引入了 Element,它会为 Vue.prototype 添加如下全局方法:$msgbox, $alert, $confirm 和 $prompt。因此在 Vue instance 中可以采用本页面中的方式调用 MessageBox
。调用参数为:
参考
https://segmentfault.com/q/1010000011472458