优化小程序码的生成

This commit is contained in:
zhl 2021-06-10 13:41:25 +08:00
parent accc2df829
commit 3a17a007e5

View File

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