I follow guide here: Vue CLI - include image from assets folder in static file
So in assets
folder I have img\pic.jpg
. I can call that image using normal html and css:
<img src="~@/assets/img/pic.jpg">
<style scoped>
.app {
background: url(~@/assets/img/pic.jpg);
}
</style>
But for directive (correct me if the term if wrong), I tried this and of course failed. Can you help?
<img :src="'~@/assets/'+user.profilepic">
//Note: user.profilepic = "img/pic.jpg"
could you try
<img :src="require(`@/assets/${user.profilepic}`)" />