本文主要是介绍blob和ArrayBuffer格式图片如何显示,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
首先blob格式图片
<template> <div> <img :src="imageURL" alt="Image" /> </div>
</template> <script>
export default { data() { return { imageBlob: null, // Blob格式的图片 imageURL: null // 图片的URL }; }, async mounted() { // 获取Blob格式的图片 // ... // 将Blob格式的图片转换为可访问的URL const objectURL = URL.createObjectURL(this.imageBlob); this.imageURL = objectURL; }
};
</script>
ArrayBuffer
let blob = new Blob( [res.data], {type:'application/vnd.ms-excel;charset=utf-8'} );
let imgUrl = URL.createObjectURL(res.data)
这篇关于blob和ArrayBuffer格式图片如何显示的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!