Skip to content

Commit 918aad0

Browse files
author
Hiram
committed
[bug] fix not find img dom
1 parent 875447f commit 918aad0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: apps/cookie-butler/static/js/cookie.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ async function scanCode(platform) {
6060
if (timeoutTimer) clearTimeout(timeoutTimer);
6161

6262
const qrcode_expired = './static/img/qrcode_expired.jpg';
63+
const img = document.getElementById('qrcode');
6364

6465
try {
6566
// 获取二维码
6667
const qrData = await qrcode_handler.startScan(platform);
6768

6869
// 显示二维码
69-
const img = document.getElementById('qrcode');
7070
img.src = qrData.qrcode;
7171

7272
// 开始轮询扫码结果
@@ -116,10 +116,10 @@ async function scanCode(platform) {
116116
}, 30000);
117117

118118
} catch (error) {
119+
console.log(error)
119120
if (pollInterval) clearInterval(pollInterval);
120121
if (timeoutTimer) clearTimeout(timeoutTimer);
121122
img.src = qrcode_expired;
122123
showToast(`获取二维码失败:${error.message}`, 'error');
123124
}
124125
}
125-

0 commit comments

Comments
 (0)