使用 muiconfirm 弹出确认框并且点击其他地方的时候 确认框关闭不回调函数 完整点代码
HTML
<button id="confirmBtn">弹出确认框</button>
JS
document.getElementById('confirmBtn').addEventListener('tap', function() {
mui.confirm('确认要执行此操作吗?', '提示', ['确认', '取消'], function(e) {
if (e.index == 0) {
// 点击了确认按钮
console.log('执行操作');
} else {
// 点击了取消按钮
console.log('取消操作');
}
});
// 点击其他地方关闭确认框,不回调函数
mui('.mui-popup').on('tap', '.mui-popup-backdrop', function() {
mui('.mui-popup').popover('hide');
});
});
原文地址: https://www.cveoy.top/t/topic/b5Yl 著作权归作者所有。请勿转载和采集!