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) } } }