vue 项目用v-for遍历图片,不能正常显示的问题,

data() {
    return {
      imgList:[
        {
          imgUrl:'../assets/img/a.png',
          imgLink:'',
          type:''
        },
        {
          imgUrl:'../assets/img/b.png',
          imgLink:'',
          type:''
        },
        {
          imgUrl:'../assets/img/c.png',
          imgLink:'',
           type:''
        },
        {
          imgUrl:'../assets/img/d.png',
          imgLink:'',
          type:''
        },
        {
          imgUrl:'../assets/img/e.png',
          imgLink:'',
          type:''
        }
      ]
 

废话不多说;

包一个   require( )  搞定

require('../assets/img/a.png')
data() {
    return {
      imgList:[
        {
          imgUrl:require('../assets/img/a.png'),
          imgLink:'',
          type:''
        },
        {
          imgUrl:require('../assets/img/b.png'),
          imgLink:'',
          type:''
        },
        {
          imgUrl:require('../assets/img/c.png'),
          imgLink:'',
           type:''
        },
        {
          imgUrl:require('../assets/img/d.png'),
          imgLink:'',
          type:''
        },
        {
          imgUrl:require('../assets/img/e.png'),
          imgLink:'',
          type:''
        }
      ]
 

 

Logo

前往低代码交流专区

更多推荐