From 49dcf1653efe5910241addc522cbfbfd74017688 Mon Sep 17 00:00:00 2001 From: Ting-Jun Wang Date: Tue, 13 Jun 2023 21:07:50 +0800 Subject: [PATCH] fix: close the camera after scanning --- src/views/ShopPayView.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/ShopPayView.vue b/src/views/ShopPayView.vue index 32b4307..a40eb5a 100644 --- a/src/views/ShopPayView.vue +++ b/src/views/ShopPayView.vue @@ -67,6 +67,7 @@ export default { console.log(`Code matched = ${decodedText}`, decodedResult); if (decodedText in this.products){ var product = this.products[decodedText] + this.scanner.clear() this.productCar.push({ 'name': product['name'], 'id': product['id'], @@ -74,10 +75,10 @@ export default { 'count': 1 }) } else { + this.scanner.clear() this.msg = "商品列表中沒有這項商品:"+decodedText this.warningModalStatus = true } - this.scanner.clear() }, scan() { this.scanner = new Html5QrcodeScanner(