Commit 929abb8b authored by hbcui1984's avatar hbcui1984

fixed:在plusReady尚未发生时调用mui.dialog发生时错误

parent 50e40a4a
...@@ -6517,23 +6517,25 @@ var mui = (function(document, undefined) { ...@@ -6517,23 +6517,25 @@ var mui = (function(document, undefined) {
/** /**
* 警告消息框 * 警告消息框
*/ */
$.alert = function(message,title,btnValue,callback) { $.alert = function(message, title, btnValue, callback) {
if ($.os.plus) { if ($.os.plus) {
if(typeof message === undefined){ if (typeof message === undefined) {
return; return;
}else{ } else {
if(typeof title ==='function'){ if (typeof title === 'function') {
callback = title; callback = title;
title = null; title = null;
btnValue = '确定'; btnValue = '确定';
}else if(typeof btnValue ==='function'){ } else if (typeof btnValue === 'function') {
callback = btnValue; callback = btnValue;
btnValue = null; btnValue = null;
} }
plus.nativeUI.alert(message,callback,title,btnValue); $.plusReady(function() {
plus.nativeUI.alert(message, callback, title, btnValue);
});
} }
}else{ } else {
//TODO H5版本 //TODO H5版本
window.alert(message); window.alert(message);
} }
...@@ -6557,7 +6559,9 @@ var mui = (function(document, undefined) { ...@@ -6557,7 +6559,9 @@ var mui = (function(document, undefined) {
callback = btnArray; callback = btnArray;
btnArray = null; btnArray = null;
} }
plus.nativeUI.confirm(message, callback, title, btnArray); $.plusReady(function() {
plus.nativeUI.confirm(message, callback, title, btnArray);
});
} }
} else { } else {
...@@ -6598,7 +6602,9 @@ var mui = (function(document, undefined) { ...@@ -6598,7 +6602,9 @@ var mui = (function(document, undefined) {
callback = btnArray; callback = btnArray;
btnArray = null; btnArray = null;
} }
plus.nativeUI.prompt(text, callback, title, defaultText, btnArray); $.plusReady(function() {
plus.nativeUI.prompt(text, callback, title, defaultText, btnArray);
});
} }
} else { } else {
...@@ -6624,17 +6630,21 @@ var mui = (function(document, undefined) { ...@@ -6624,17 +6630,21 @@ var mui = (function(document, undefined) {
* 自动消失提示框 * 自动消失提示框
*/ */
$.toast = function(message) { $.toast = function(message) {
if($.os.plus){ if ($.os.plus) {
//默认显示在底部; //默认显示在底部;
plus.nativeUI.toast(message,{verticalAlign:'bottom'}); $.plusReady(function() {
}else{ plus.nativeUI.toast(message, {
verticalAlign: 'bottom'
});
});
} else {
var toast = document.createElement('div'); var toast = document.createElement('div');
toast.classList.add('mui-toast-container'); toast.classList.add('mui-toast-container');
toast.innerHTML = '<div class="'+'mui-toast-message'+'">'+message+'</div>'; toast.innerHTML = '<div class="' + 'mui-toast-message' + '">' + message + '</div>';
document.body.appendChild(toast); document.body.appendChild(toast);
setTimeout(function(){ setTimeout(function() {
document.body.removeChild(toast); document.body.removeChild(toast);
},2000); }, 2000);
} }
}; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6517,23 +6517,25 @@ var mui = (function(document, undefined) { ...@@ -6517,23 +6517,25 @@ var mui = (function(document, undefined) {
/** /**
* 警告消息框 * 警告消息框
*/ */
$.alert = function(message,title,btnValue,callback) { $.alert = function(message, title, btnValue, callback) {
if ($.os.plus) { if ($.os.plus) {
if(typeof message === undefined){ if (typeof message === undefined) {
return; return;
}else{ } else {
if(typeof title ==='function'){ if (typeof title === 'function') {
callback = title; callback = title;
title = null; title = null;
btnValue = '确定'; btnValue = '确定';
}else if(typeof btnValue ==='function'){ } else if (typeof btnValue === 'function') {
callback = btnValue; callback = btnValue;
btnValue = null; btnValue = null;
} }
plus.nativeUI.alert(message,callback,title,btnValue); $.plusReady(function() {
plus.nativeUI.alert(message, callback, title, btnValue);
});
} }
}else{ } else {
//TODO H5版本 //TODO H5版本
window.alert(message); window.alert(message);
} }
...@@ -6557,7 +6559,9 @@ var mui = (function(document, undefined) { ...@@ -6557,7 +6559,9 @@ var mui = (function(document, undefined) {
callback = btnArray; callback = btnArray;
btnArray = null; btnArray = null;
} }
plus.nativeUI.confirm(message, callback, title, btnArray); $.plusReady(function() {
plus.nativeUI.confirm(message, callback, title, btnArray);
});
} }
} else { } else {
...@@ -6598,7 +6602,9 @@ var mui = (function(document, undefined) { ...@@ -6598,7 +6602,9 @@ var mui = (function(document, undefined) {
callback = btnArray; callback = btnArray;
btnArray = null; btnArray = null;
} }
plus.nativeUI.prompt(text, callback, title, defaultText, btnArray); $.plusReady(function() {
plus.nativeUI.prompt(text, callback, title, defaultText, btnArray);
});
} }
} else { } else {
...@@ -6624,17 +6630,21 @@ var mui = (function(document, undefined) { ...@@ -6624,17 +6630,21 @@ var mui = (function(document, undefined) {
* 自动消失提示框 * 自动消失提示框
*/ */
$.toast = function(message) { $.toast = function(message) {
if($.os.plus){ if ($.os.plus) {
//默认显示在底部; //默认显示在底部;
plus.nativeUI.toast(message,{verticalAlign:'bottom'}); $.plusReady(function() {
}else{ plus.nativeUI.toast(message, {
verticalAlign: 'bottom'
});
});
} else {
var toast = document.createElement('div'); var toast = document.createElement('div');
toast.classList.add('mui-toast-container'); toast.classList.add('mui-toast-container');
toast.innerHTML = '<div class="'+'mui-toast-message'+'">'+message+'</div>'; toast.innerHTML = '<div class="' + 'mui-toast-message' + '">' + message + '</div>';
document.body.appendChild(toast); document.body.appendChild(toast);
setTimeout(function(){ setTimeout(function() {
document.body.removeChild(toast); document.body.removeChild(toast);
},2000); }, 2000);
} }
}; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,23 +2,25 @@ ...@@ -2,23 +2,25 @@
/** /**
* 警告消息框 * 警告消息框
*/ */
$.alert = function(message,title,btnValue,callback) { $.alert = function(message, title, btnValue, callback) {
if ($.os.plus) { if ($.os.plus) {
if(typeof message === undefined){ if (typeof message === undefined) {
return; return;
}else{ } else {
if(typeof title ==='function'){ if (typeof title === 'function') {
callback = title; callback = title;
title = null; title = null;
btnValue = '确定'; btnValue = '确定';
}else if(typeof btnValue ==='function'){ } else if (typeof btnValue === 'function') {
callback = btnValue; callback = btnValue;
btnValue = null; btnValue = null;
} }
plus.nativeUI.alert(message,callback,title,btnValue); $.plusReady(function() {
plus.nativeUI.alert(message, callback, title, btnValue);
});
} }
}else{ } else {
//TODO H5版本 //TODO H5版本
window.alert(message); window.alert(message);
} }
......
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
callback = btnArray; callback = btnArray;
btnArray = null; btnArray = null;
} }
plus.nativeUI.confirm(message, callback, title, btnArray); $.plusReady(function() {
plus.nativeUI.confirm(message, callback, title, btnArray);
});
} }
} else { } else {
......
...@@ -21,7 +21,9 @@ ...@@ -21,7 +21,9 @@
callback = btnArray; callback = btnArray;
btnArray = null; btnArray = null;
} }
plus.nativeUI.prompt(text, callback, title, defaultText, btnArray); $.plusReady(function() {
plus.nativeUI.prompt(text, callback, title, defaultText, btnArray);
});
} }
} else { } else {
......
...@@ -3,17 +3,21 @@ ...@@ -3,17 +3,21 @@
* 自动消失提示框 * 自动消失提示框
*/ */
$.toast = function(message) { $.toast = function(message) {
if($.os.plus){ if ($.os.plus) {
//默认显示在底部; //默认显示在底部;
plus.nativeUI.toast(message,{verticalAlign:'bottom'}); $.plusReady(function() {
}else{ plus.nativeUI.toast(message, {
verticalAlign: 'bottom'
});
});
} else {
var toast = document.createElement('div'); var toast = document.createElement('div');
toast.classList.add($.className('toast-container')); toast.classList.add($.className('toast-container'));
toast.innerHTML = '<div class="'+$.className('toast-message')+'">'+message+'</div>'; toast.innerHTML = '<div class="' + $.className('toast-message') + '">' + message + '</div>';
document.body.appendChild(toast); document.body.appendChild(toast);
setTimeout(function(){ setTimeout(function() {
document.body.removeChild(toast); document.body.removeChild(toast);
},2000); }, 2000);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment