(function($, window) { /** * 确认消息框 */ $.confirm = function(message, title, btnArray, callback) { if ($.os.plus) { if (typeof message === 'undefined') { return; } else { if (typeof title === 'function') { callback = title; title = null; btnArray = null; } else if (typeof btnArray === 'function') { callback = btnArray; btnArray = null; } $.plusReady(function() { plus.nativeUI.confirm(message, callback, title, btnArray); }); } } else { //H5版本,0为确认,1为取消 if (window.confirm(message)) { callback({ index: 0 }); } else { callback({ index: 1 }); } } }; })(mui, window);