S
S
Sergey750il2022-01-28 19:25:58
Frontend
Sergey750il, 2022-01-28 19:25:58

How to pass image url through props and display in :style?

Good day. Via props comes the name of the image (icon.png). How to display it in v-bind:style={background:url(here)};
The image is in assets

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Koren, 2022-02-19
@IlyaMalone

Good afternoon. After all, to draw an image, you need to specify the url path, respectively, in v-bind:, you need to specify the path relative to the element in which you want to draw the image. For example, using backticks: `../assets/${propsName}`.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question