From 849669962d1d2aa8ebaac300930b706d7ae51573 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 24 Feb 2026 18:16:06 +0800 Subject: [PATCH] bugfix --- bricks/qr.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bricks/qr.js b/bricks/qr.js index fb3d00e..e6056fd 100644 --- a/bricks/qr.js +++ b/bricks/qr.js @@ -1,5 +1,14 @@ var bricks = window.bricks || {}; bricks.QRCodeScan = class extends bricks.VBox { + /* + event: + recognized + 识别到二维码 + 参数为识别到的正文 + stopped + 扫码已停止 + 无参数 + */ constructor(opts){ opts.width = '300px'; opts.height = '300px'; @@ -16,7 +25,7 @@ bricks.QRCodeScan = class extends bricks.VBox { get_qr_result(decodedText, decodedResult){ this.dispatch('recognized', decodedText) console.log('decodeText=', decodedText) - this.stop() + this.scanner.stop() } errorhandle(msg){ console.log("识别失败:", msg); @@ -35,6 +44,7 @@ bricks.QRCodeScan = class extends bricks.VBox { stop(){ if this.scanner && this.scanner.getState() !== Html5QrcodeScannerState.NOT_STARTED) { this.scanner.stop() + this.dispatch('stopped', decodedText) } } }