I have a request to an url that retrieves an image, it's something like this:
this.$http.get(url, { }).success( (data) => {
console.log(data)
});
The result of console.log(data) is somethis like this
PNG IHDR SZ sRGB gAMA a pHYs o d IDATx^ t ֵ= 3333339qb...
So, how can I convert this result to a base64 string ?
您可以使用btoa
方法:
console.log(window.btoa(data))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.