the backend interface returns the picture printed out is a pile of garbled code, how to display
GIF89a stories, / h "(OCU" Q "EO;"? "F" zvC "N" zqc "l" V+ "8"1" EO; } "tn" z "GI" ^ $"y"7 +" ^ "^" d "w] L" 7 "" Y "_ X" Fa "uaGU" P "- sharp >" aT, " "
.
/ No, no, no. {
"code": 200
}
after converting it with createObjectURL, it still cannot be displayed
const myBlob = new window.Blob([data], {type: "image/gif"})
const qrUrl = window.URL.createObjectURL(myBlob)
var img = document.createElement("img")
img.src = qrUrl
img.onload = function () {
window.URL.revokeObjectURL(qrUrl)
}
const imgDiv = document.querySelector(".qr-div")
imgDiv.appendChild(img)
according to Baidu"s method on the Internet, it is not possible to
transfer to base64
"data:image/gif;base64," + Base64.encode (res.data.toString ())
- what should the front end do when the backend should not be returned?
- the string of garbled codes just now should be displayed after the picture format is printed, but what is the following code: 200s, is it superfluous?
resolved:
axios responseType: "blob"
createObjectURL
```
const qrUrl = window.URL.createObjectURL(res.data)
var img = document.createElement("img")
img.src = qrUrl
img.onload = function () {
window.URL.revokeObjectURL(qrUrl)
}
const imgDiv = document.querySelector(".qr-div")
imgDiv.appendChild(img)
```