yoyo-ng-modulewindy
Version:
服务于52ABP模板的前端开源的相关组件内容。整合了ng-alain和你NG ZORRO的内容
48 lines • 1.5 kB
JavaScript
import { AdQRConfig } from './qr.config';
import { Injectable } from '@angular/core';
var QRService = /** @class */ (function () {
function QRService(cog) {
/** 背景透明级别,范围:`0-1` 之间 */
this.backgroundAlpha = 1.0;
Object.assign(this, cog);
this.qr = new QRious();
}
/**
* 生成二维码,并返回Base64编码
*
* @param [value] 重新指定值
*/
QRService.prototype.refresh = function (value) {
this.qr.set(typeof value === 'object' ? value : {
background: this.background,
backgroundAlpha: this.backgroundAlpha,
foreground: this.foreground,
foregroundAlpha: this.foregroundAlpha,
level: this.level,
padding: this.padding,
size: this.size,
value: value || this.value,
});
return this.dataURL;
};
Object.defineProperty(QRService.prototype, "dataURL", {
/**
* 返回当前二维码Base64编码
*/
get: function () {
return this.qr.toDataURL();
},
enumerable: true,
configurable: true
});
QRService.decorators = [
{ type: Injectable },
];
/** @nocollapse */
QRService.ctorParameters = function () { return [
{ type: AdQRConfig }
]; };
return QRService;
}());
export { QRService };
//# sourceMappingURL=qr.service.js.map