Question
I'm looking for the right url to reference static assets, like images within Vue javascript.
For example, I'm creating a leaflet marker using a custom icon image, and I've
tried several urls, but they all return a 404 (Not Found)
:
Main.vue:
var icon = L.icon({
iconUrl: './assets/img.png',
iconSize: [25, 25],
iconAnchor: [12, 12]
});
I've tried putting the images in the assets folder and the static folder with no luck. Do I have to tell vue to load those images somehow?
Answer
For anyone looking to refer images from template, You can refer images directly using '@'
Example:
<img src="@/assets/images/home.png"/>