How do you generate a blob URL?
问题 I'm trying to set the img and src to blob URL in vuejs. I have tried to call loadImg() method inside img and src ; It didn't work. Here is my code: <template> <a v-for="(post,index) in posts" :key="index"> <img :src="loadImg(post.img)" > </a> </template> methods:{ loadImg: function (img) { fetch(img) .then(function(t){return t.blob()}) .then(function(e){ return URL.createObjectURL(e); } ) } } How do I set the image src to blob url? codesandbox => https://codesandbox.io/embed/2vmwj2k550 回答1: