Browse Source

无JIRA toast容错

es6
zsmj 2 years ago
parent
commit
4360c7dba9
  1. 10
      src/base/foundation/message.js

10
src/base/foundation/message.js

@ -22,7 +22,7 @@ BI.Msg = function () {
// BI.Msg.prompt(title, message, value, callback, min_width);
},
toast: function (message, options, context) {
BI.isString(options) && (options = { level: options })
BI.isString(options) && (options = { level: options });
options = options || {};
context = context || BI.Widget._renderEngine.createElement("body");
var level = options.level || "common";
@ -41,7 +41,7 @@ BI.Msg = function () {
BI.remove(toastStack, toast.element);
var _height = BI.SIZE_CONSANTS.TOAST_TOP;
BI.each(toastStack, function (i, element) {
element.css({"top": _height});
element.css({ "top": _height });
_height += element.outerHeight() + 10;
});
callback();
@ -62,16 +62,16 @@ BI.Msg = function () {
}]
});
toastStack.push(toast.element);
toast.element.css({"margin-left": -1 * toast.element.outerWidth() / 2});
toast.element.css({ "margin-left": -1 * toast.element.outerWidth() / 2 });
toast.element.removeClass("bi-message-leave").addClass("bi-message-enter");
autoClose && BI.delay(function () {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy();
toast.destroy?.();
}, 5000);
return function () {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy();
toast.destroy?.();
};
},
_show: function (hasCancel, title, message, callback) {

Loading…
Cancel
Save