![](/img/trans.png)
[英]How to display image in angular(image uploded in server side uploads folder and angularjs is working in different server)?
[英]Get image from server side folder and display image in Vue
我正在嘗試從我的節點 api 目錄的公共文件夾中顯示圖像。 我想在前端 vue 文件中顯示圖像。 我不知道如何給出圖像來源。
這是目錄。 我想顯示圖像nodelogin.png
我想顯示這些圖像。
<img :src="myimage" alt="Logo" width="80" height="80" />
這是我的模板代碼。
async created() {
this.myimage = await this.getImage();
},
methods: {
async getImage(){
return await 'http://localhost:4000/api/public/nodelogin.png';
}
}
但是這段代碼給出了錯誤響應。 Cannot GET /api/public/nodelogin.png
實際上我是 node 和 Vue 的新手所以我不確定我的邏輯是否正確。
我需要從后端做些什么嗎?
只需使用 url '/nodelogin.png'
感謝您發布問題。
如果要查看 png,則應輸入 url:
http://localhost:4000/nodelogin.png
祝您生意興隆。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.