SoFunction
Updated on 2025-04-05

How to implement images in assets in Vue

How to reference images in assets in vue

Introduced as img tag

 <img class="img"  alt="example" :src="require('./../assets/image/')">

Introduced as background image

<span  :style="'background-image:url('+require('./../assets/image/')+')'" ></span>

Solve the problem of not finding the image path under Vue import assets

<img :src="imgsrc2">

export default{

     data(){  

     imgsrc2: require('../assets/')
     }

}

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.