fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

8 years ago
/**
* toast提示
*
* Created by GUY on 2015/9/7.
* @class BI.Toast
* @extends BI.Tip
*/
BI.Toast = BI.inherit(BI.Tip, {
_const: {
minWidth: 200,
hgap: 20
},
_defaultConfig: function () {
return BI.extend(BI.Toast.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-toast",
text: "",
7 years ago
level: "success", // success或warning
8 years ago
height: 30
7 years ago
});
8 years ago
},
_init: function () {
BI.Toast.superclass._init.apply(this, arguments);
var o = this.options;
this.element.css({
minWidth: this._const.minWidth + "px"
7 years ago
});
8 years ago
this.element.addClass("toast-" + o.level);
var fn = function (e) {
e.stopPropagation();
e.stopEvent();
return false;
};
7 years ago
this.element.bind({click: fn, mousedown: fn, mouseup: fn, mouseover: fn, mouseenter: fn, mouseleave: fn, mousemove: fn});
8 years ago
this.text = BI.createWidget({
type: "bi.label",
8 years ago
element: this,
8 years ago
text: o.text,
height: 30,
hgap: this._const.hgap
7 years ago
});
8 years ago
},
7 years ago
setWidth: function (width) {
8 years ago
this.element.width(width);
},
setText: function (text) {
this.text.setText(text);
}
});
8 years ago
BI.shortcut("bi.toast", BI.Toast);