Why doesn't the picture show?

<template>
    <ul>
        <li v-for="item in bookList" :key="item.id">
            <img src="../assets/images/book1.jpg" style="width: 100px; height: 100px;">
            <img :src="item.book_url" style="width: 100px; height: 100px;">
            <span>{{item.book_title}}</span>
            <i class="el-icon-remove-outline"></i>
            <span>{{item.book_price}}</span>
            <i class="el-icon-circle-plus-outline"></i>
        </li>
    </ul>
</template>
<script>
export default {
  data () {
      return {
          bookList: []
      }
  },
  mounted () {
    this.bookList = [{
        id: "0",
        book_url: "../assets/images/book1.jpg",
        book_title: "dsd",
        book_price: "39"
        },{
        id: "1",
        book_url: "../assets/images/book2.jpg",
        book_title: "dfg",
        book_price: "45"
        },{
        id: "2",
        book_url: "../assets/images/book3.jpg",
        book_title: "dsfgd",
        book_price: "59"
        }
    ]
  }
  
}
</script>

<style lang="scss" scoped>
    ul {
        list-style-type: none;
    }
</style>

clipboard.png

Sep.26,2021

positive solution upstairs

pay attention to the image resources required by these frameworks, rather than a string path, otherwise the compiler will not recognize this as a picture, and wisdom will be treated as an ordinary string

so you need to add require


For

pictures in js, you should use require to introduce:

  this.bookList = [{
    id: '0',
    book_url: require('../assets/images/book1.jpg'),
    book_title: 'dsd',
    book_price: '39'
    },{
    id: '1',
    book_url: require('../assets/images/book2.jpg'),
    book_title: 'dfg',
    book_price: '45'
    },{
    id: '2',
    book_url: require('../assets/images/book3.jpg'),
    book_title: 'dsfgd',
    book_price: '59'
    }
]
Menu