How do I bind a :src for an image in the child component?

前端 未结 3 619
暖寄归人
暖寄归人 2020-12-07 03:33

I am attempting to render a list of components. All the data properties are displaying correctly except the img src url.

the files/folders are :

CryptConten

3条回答
  •  忘掉有多难
    2020-12-07 03:34

    With webpack images are considered as modules so you should import or require them like :

     allcards : [ {id:0, name: 'Jim Zombie',graphic: require('./assets/jim.svg'), ....]
    

    or

      import img from './assets/jim.svg';
      export default{
           ...
             data(){
                 return {
                   allcards : [ {id:0, name: 'Jim Zombie',graphic: img, ....],
                     ...
                    }
                 }
             ...
    
            }
    

提交回复
热议问题