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.
|
|
|
/**
|
|
|
|
* 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: "",
|
|
|
|
level: "success",//success或warning
|
|
|
|
height: 30
|
|
|
|
})
|
|
|
|
},
|
|
|
|
_init: function () {
|
|
|
|
BI.Toast.superclass._init.apply(this, arguments);
|
|
|
|
var o = this.options;
|
|
|
|
this.element.css({
|
|
|
|
minWidth: this._const.minWidth + "px"
|
|
|
|
})
|
|
|
|
this.element.addClass("toast-" + o.level);
|
|
|
|
var fn = function (e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopEvent();
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
this.element.bind({"click": fn, "mousedown": fn, "mouseup": fn, "mouseover": fn, "mouseenter": fn, "mouseleave": fn, "mousemove": fn});
|
|
|
|
|
|
|
|
this.text = BI.createWidget({
|
|
|
|
type: "bi.label",
|
|
|
|
element: this,
|
|
|
|
text: o.text,
|
|
|
|
height: 30,
|
|
|
|
hgap: this._const.hgap
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
setWidth: function(width){
|
|
|
|
this.element.width(width);
|
|
|
|
},
|
|
|
|
|
|
|
|
setText: function (text) {
|
|
|
|
this.text.setText(text);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
BI.shortcut("bi.toast", BI.Toast);
|