33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
|
|
/* QRCode.js - Local Fallback */
|
||
|
|
(function() {
|
||
|
|
'use strict';
|
||
|
|
|
||
|
|
// 简化的 QRCode 备用实现
|
||
|
|
window.QRCode = function(element, options) {
|
||
|
|
this.element = typeof element === 'string' ? document.getElementById(element) : element;
|
||
|
|
this.options = options || {};
|
||
|
|
|
||
|
|
if (this.element) {
|
||
|
|
this.element.innerHTML = '<div style="width: 128px; height: 128px; border: 1px solid #ddd; display: flex; align-items: center; justify-content: center; background: #f9f9f9; font-size: 12px; text-align: center;">' +
|
||
|
|
'二维码生成器<br/>暂时不可用</div>';
|
||
|
|
}
|
||
|
|
|
||
|
|
return this;
|
||
|
|
};
|
||
|
|
|
||
|
|
// 添加基本方法
|
||
|
|
window.QRCode.prototype = {
|
||
|
|
makeCode: function(text) {
|
||
|
|
console.warn('QRCode 本地备用版本 - 功能受限');
|
||
|
|
if (this.element) {
|
||
|
|
this.element.innerHTML = '<div style="width: 128px; height: 128px; border: 1px solid #ddd; display: flex; align-items: center; justify-content: center; background: #f9f9f9; font-size: 10px; text-align: center; word-break: break-all; padding: 5px;">' +
|
||
|
|
text + '</div>';
|
||
|
|
}
|
||
|
|
},
|
||
|
|
clear: function() {
|
||
|
|
if (this.element) {
|
||
|
|
this.element.innerHTML = '';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
};
|
||
|
|
})();
|