VueJS background-image url not finding the path

Viewed 939

i am learning VueJs and i'm blocked. My problem is that i don't know which path i need to give to the url of my background-image property on the component css part.

<template>
  <div class="layer"></div>
<template>

<script>
 export default {
   name: 'Layer'
 }
</script>

<style lang="scss">
.layer{
  background-image: url(../public/images/myImage.jpg)
}
</style>

What url do i need to put? My image is on 'public/images/myImage.jpg' My component Layer is on 'src/components/Layer.vue'

Thank you

1 Answers

if your img is on public, just write as relative path:

.layer{
  background-image: url('/images/myImage.jpg')
}
Related