Vue carries the header image loading solution
When accessing the url requires permission to access it (if you need to carry a token), you can download it using axios first, and then convert it to url and assign it to img through URL.createObjectURL ()
async getBarcode(row) {
const { data: result } = await this.$axio.get(
"book/barcode?id="+row.id,
{
//设定接收类型为blob,头部什么的自行添加
responseType:'blob',
}
);
//赋值给变量
this.barcodeUrl=URL.createObjectURL(result);
this.barcodeDialogVisible=true;
},
<el-image style="width: 200px; height: 100px" :src="barcodeUrl" placeholder="Barcode"></el-image>