1
<el-image :src="imgSrc" :lazy="imgSrc ? true : false" />
2
const imgSrc = ref("");
const handleImage = async (url: string) => {
const res = await getImage(url);
imgSrc.value = res;
};
handleImage("img-src");
3
export const getImage = async (url: string) => {
const res = await axios({
url,
method: "get",
responseType: "blob"
});
return URL.createObjectURL(res);
};
1