Vue.js: src is a http resource that is forwarded to localhost

template Code

  <div class="img-container">
    <img :src="item[index]" v-for="(item,index) in dataList.imgList" />
  </div>

script Code

  data(){
  return{
    dataList:{
      imgList:[
        "http://img.zcool.cn/community/013a4456f2626f32f875a944208731.jpg",
        "http://img.zcool.cn/community/038025357ebd1e5a84a0d304f6b9c4a.jpg"
              ]
            }
          }
        }

the result becomes

in the browser.

clipboard.png

has url-loader

Mar.24,2021

' http://img.zcool.cn/community.'[0] is h, and it should be < div class=" img-container ">

.
<img :src="item" v-for="(item,index) in dataList.imgList" />

< / div >


you can see for yourself what your item is and you will know how to write it

.
<div class="img-container">
    <img :src="item" v-for="(item,index) in dataList.imgList" />
  </div>
Menu