<div id="qrcode" style="display: none"></div>
import QRCode from 'qrcodejs2'
components: {
QRCode,
},
methods: {
qrcode(record) {
let qrcode = new QRCode('qrcode', {
width: 500,
height: 500,
text: `http://www.baidu.com/`,
render: 'canvas' ,
})
},
downloadImg(record) {
this.qrcode(record)
const myCanvas = document.getElementById('qrcode').getElementsByTagName("canvas")
const a = document.createElement('a')
a.href = myCanvas[0].toDataURL('image/png')
a.download = record.activityName
a.click()
this.$message.success('下载成功')
},
}