From 3a17a007e56cf19d0453a11219b215c62e7f74bc Mon Sep 17 00:00:00 2001 From: zhl Date: Thu, 10 Jun 2021 13:41:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/game/game_setting.vue | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/views/game/game_setting.vue b/src/views/game/game_setting.vue index 317a755..5c07e63 100644 --- a/src/views/game/game_setting.vue +++ b/src/views/game/game_setting.vue @@ -506,21 +506,20 @@ export default class extends Vue { const canvas = document.getElementById('qr_canvas') as HTMLCanvasElement if (!canvas) { return false - } else { - // 可以理解为一个画笔,可画路径、矩形、文字、图像 - const context = canvas.getContext('2d') - context!.clearRect(0, 0, QR_WIDTH, QR_WIDTH) - const img = new Image() - img.src = this.qrUrl + '?t=' + new Date().getDate() - img.setAttribute('crossOrigin', 'Anonymous') - // 加载图片 - img.onload = () => { - if (img.complete) { - // 绘制图片 - context!.drawImage(img, 0, 0, QR_WIDTH, QR_WIDTH) - if (this.shopLogo) { - this.drawLogo(context) - } + } + // 可以理解为一个画笔,可画路径、矩形、文字、图像 + const context = canvas.getContext('2d') + context!.clearRect(0, 0, QR_WIDTH, QR_WIDTH) + const img = new Image() + img.src = this.qrUrl + '?t=' + new Date().getDate() + img.setAttribute('crossOrigin', 'Anonymous') + // 加载图片 + img.onload = () => { + if (img.complete) { + // 绘制图片 + context!.drawImage(img, 0, 0, QR_WIDTH, QR_WIDTH) + if (this.shopLogo) { + this.drawLogo(context) } } }