const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
document.getElementById(`canvas${index}`).innerHTML = ''
const qrcode = new QRCode(`canvas${index}`, {
width: 120,
height: 120,
text: encodeURI(`www.baidu.com/?from=${item.iden}`),
colorDark: '#ffffff',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
})
setTimeout( () => {
console.log(qrcode._el.childNodes[1].src)
var file = this.base64ToFile(qrcode._el.childNodes[1].src)
let formData = new FormData()
formData.append('file', file)
upOssImage(formData).then(res => {
loading.close()
item.img = res
}).catch(() => {
this.$message.error('上传图片失败')
})
}, 500)
```
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28