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.

37 lines
942 B

/**
* 复制
* Created by GUY on 2016/2/16.
* @class BI.ClipBoard
* @extends BI.BasicButton
*/
BI.ClipBoard = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.ClipBoard.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-clipboard",
text: "",
afterCopy: BI.emptyFn
})
},
_init: function () {
BI.ClipBoard.superclass._init.apply(this, arguments);
},
mounted: function () {
var self = this, o = this.options;
this.clipboard = new Clipboard(this.element[0], {
text: function () {
return BI.isFunction(o.text) ? o.text() : o.text;
}
});
this.clipboard.on("success", function (e) {
o.afterCopy();
})
},
destroyed: function () {
this.clipboard.destroy();
}
});
BI.shortcut("bi.clipboard", BI.ClipBoard);