I'm trying to display background image in a component.
If I understand it well, we must use that:
<div class="food-icon"
:title="tooltip"
:style="{backgroundImage: `url(${require(image)})`}">
But I get this error
Error in render: "Error: Cannot find module '../assets/fast-food.jpg'"
I try it with:
<div class="food-icon"
:title="tooltip"
:style="{backgroundImage: `url(${require('../assets/fast-food.jpg')})`}">
And that works well, i don't understand why.