(function($, window) { /** * 输入对话框 */ $.prompt = function(text, defaultText, title, btnArray, callback) { if ($.os.plus) { if (typeof message === 'undefined') { return; } else { if (typeof defaultText === 'function') { callback = defaultText; defaultText = null; title = null; btnArray = null; } else if (typeof title === 'function') { callback = title; title = null; btnArray = null; } else if (typeof btnArray === 'function') { callback = btnArray; btnArray = null; } $.plusReady(function() { plus.nativeUI.prompt(text, callback, title, defaultText, btnArray); }); } } else { //H5版本(确认index为0,取消index为1) var result = window.prompt(text); if (result) { callback({ index: 0, value: result }); } else { callback({ index: 1, value: '' }); } } }; })(mui, window);