Using Vue CLI
Hi, I'm currently updgrading a website with vue.js and everything works fine except for background images.
Inside one of the views, I have this code:
<div v-for="(member, i) in team" :style="{'background-image': `linear-gradient(-225deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, var(--end-opacity)) 50%),url(${require(getStyle(i))})`}" :key="i">
<h2>{{member.name}}</h2>
<p class="member-desc">{{text.about.members[i]}}</p>
</div>
I get background image url from a json file (image is stored in assets folder) and it looks like this : '@/assets/images/nicolas.jpg'. The "getStyle" function defined in methods looks like this :
getStyle (index) {
return this.team[index].image
}
The problem is the website doesn't show images and returns GET http://localhost:8080/@/assets/images/nicolas.jpg error.
If I change urls to images stored on the web it works, but not locally. Is there any reason why?