我需要在vue的img里直接显示本地路径的图片,原因是我的图片名是动态后端获取的,但是控制台会报错Not allowed to load local resource,createObjectURL无效,请问要如何解决
export default {
data() {
return {
imageUrls: []
}
},
mounted() {
API({
url: 'http://127.0.0.1:8000/K_means',
method: 'get'
}).then((res) => {
this.$nextTick(() => {
console.log(res.data.image_urls)
this.imageUrls = res.data.image_urls
})
}).catch(error => {
console.log(error)
})
},
}
</script>
<template>
<div>
<div v-for="(image, index) in imageUrls" :key="index">
<img :src="`D:/pycharmentryprice/djangoProject/Invertor/static_file/${image}`" alt="My Plot">
</div>
</div>
</template>