1

this is one of my first projects with vue.

Basically, I am trying to display an image from a URL from an array. On the webpage, the URL is in the image back but the actual image is not displaying.

This is in my main vue class

  <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>

then the script code:

<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

I have declared a width and a height of the image as well with css

I should mention i getting the information from the database in a node project and connecting by a port number

I am pretty new to stack so I would love any feedback, cheers

1 Answer 1

1

From you screenshot code, this looks fine. I can see the image by writing similar 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/

Try clearing your cache or reload the page by Holding the Ctrl key and press the F5 key.

Thanks!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.