[Vuejs]-Vue – component background image url error

0👍

You can use it as follows.

style() {
  return {
    "background-image": `url(${require(`@/assets/images/${this
      .last_result}.png`)})`
  };
},

Try using obsolute path.

your obsolute path would be @/assets/images/ if your assets folder exists in src/assets/images/.

And if you want to user relative path refer to this ../../../assets/images/ path from your current component.

Hope it helps.

Leave a comment