// 生产二维码
async handleVerification($index, row) {
try {
this.QRImage = await QRCode.toDataURL(`${qrcodeUrl}#/pages/welfareMall/redeemConfirm?id=${row.id}`)
} catch (e) {
this.$message({
type: "error",
message: "获取二维码失败,请重试"
})
return this.verificationVisible = false
}
this.verificationVisible = true
},
// 下载二维码
downloadBase64AsImage(base64Data, fileName) {
const link = document.createElement('a');
link.href = base64Data;
link.download = fileName; // 文件名
const clickEvent = new MouseEvent('click', { bubbles: true });
link.dispatchEvent(clickEvent);
},
// 调用
this.downloadBase64AsImage(this.QRImage, '兑换凭证二维码');