我的反馈功能确认存在问题
sweetAlert: function() {
window.legacyConfirm = window.confirm;
window.confirm = function(msg, title, type, callback, params) {
var title = (title == null) ? 'Warning!' : title;
var test = 0;
var type = (type == null) ? 'warning' : type;
swal({
title: title,
text: msg,
type: type,
showCancelButton: true,
allowEscapeKey: false,
allowOutsideClick: false
}, function(isConfirm) {
if (isConfirm) {return true} else {return false}
});
};
},
removeItem: function(el) {
var test;
var $el = $(this),
_comfirm = $el.data('confirm') ? $el.data('confirm') : 'Remove product';
if (confirm(_comfirm)) {
console.log("OK")
}
}
removeItem方法调用以确认在方法sweetAlert中声明。
确认始终返回undefined,并且不调用循环方法removeItem。
if (confirm(_comfirm)) {
console.log("OK")
}