后台返回是:
而我在浏览器响应里看到的是:
解决方法:
function getIdentifyingCode( callback) {
var xhr = new XMLHttpRequest()
xhr.responseType = "blob";
var url = ``
xhr.open("GET", url)
xhr.send()
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(xhr.response)
}
}
}
getIdentifyingCode(signature, function (res) {
let blob = res
url = URL.createObjectURL(blob)
document.getElementById('img1').src = url
})