html - Vue - 我正在尝试显示来自数组 url 的图像,但图像未显示

标签 html css vue.js vuejs2 vue-component

这是我使用 vue 的第一个元素。

基本上,我试图从数组的 URL 中显示图像。 在网页上,网址在图片后面,但实际图片不显示。

这是在我的主要 vue 类中

  <div id="painting">
    <ul v-if="artwork && artwork.length">
       <li v-for='(artworks, index) in artwork' :key='index'>
          <img v-bind:src="artworks.thumbnailUrl" />
       </li>
    </ul>
    <router-view/>
  </div>

然后是脚本代码:

<script>
  import axios from 'axios';  
  
  export default {
   data() {
     return {
        artwork: []
      }
   },
   
   created() {
     axios.get(`http://localhost:9000/artwork`)
       .then(response => {
          this.artwork = response.data;
       })
       .catch(e => {
          this.errors.push(e)
       })
     }
   }
 </script>

This is what it looks like on the web, the url is there but no picture

我已经用 css 声明了图像的宽度和高度

我应该提到我从节点元素的数据库中获取信息并通过端口号连接

我是堆栈的新手,所以我希望得到任何反馈,干杯

最佳答案

从您的屏幕截图代码来看,这看起来不错。我可以通过编写类似的 HTML 来查看图像

<li>
<img data-v-xcxcc src="http://www.tate.org.uk/art/images/work/A/A00/A00007_8.jpg" />
</li>

https://jsfiddle.net/y2m75usk/

尝试清除缓存或通过按住 Ctrl 键并按 F5 键重新加载页面。

谢谢!

关于html - Vue - 我正在尝试显示来自数组 url 的图像,但图像未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47554204/

相关文章:

html - 我无法创建导航栏子菜单

javascript - 带直播的VideoJs

javascript - 转到上一页时更改文本

html - 下拉悬停在 IE9 中不保持打开状态

html - Bootstrap 4,根据我们在第一列上滚动的位置更改第二列内容

vue.js - ApexCharts 如何动态更新 y 轴刻度?

java - 以 HTML 形式传递字符串数组并提交给 Java Spring Controller?

javascript - Angular url 中的 $locationProvider

javascript - Vue JS 应用程序上的 Passport JS 身份验证

amazon-web-services - 如何将前端应用程序正确部署到 GCE?