一、前端
1、主要是img
<div v-if="this.content !== ''"><img :src="this.content" style="width: 100px; height: 100px;"></div>
2、方法:請求後臺獲取圖片流
async jointTable(){
const axios = require('axios');
if(this.dataForm !== '' && this.dataForm != null){
axios({
method: 'get',
url: '/signin-app/signin/dy-img/qr',
params: {
idCard:this.dataForm.idCard
},
responseType: 'arraybuffer'
}).then(response => {
if (response.data) {
let img = 'data:image/png;base64,'+ btoa(new Uint8Array(response.data).reduce((data, byte) => data + String.fromCharCode(byte), ''));
this.content = img;
}else{
this.content = ''
}
})
}
},