upload(res) {
const image = new Image()
//blob:http://localhost:8080/b878edea-e649-4f8d-b723-c3f25454141b
image.src = res;
image.onload = () => {
const canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
const context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height);
let imgUrl = canvas.toDataURL() //图片的base64地址
console.log(imgUrl);
}
},
blob url路径转base64
最新推荐文章于 2024-03-26 21:55:32 发布