R
R
reinmaker902020-11-05 17:12:03
Vue.js
reinmaker90, 2020-11-05 17:12:03

How to set image src value dynamically?

How to pass a link to the src attribute with interpolation of a part of a string from an array?

<img :src=`https://site.org/img/{{array.data[0].icon}}.png` alt="">

So he substitutes the correct value of the link, but the picture does not work out, how to do it right?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Pautov, 2020-11-05
@reinmaker1990

<img :src=`https://site.org/img/${array.data[0].icon}.png` alt="">

S
Sashqa, 2020-11-05
@Sashqa

template strings

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question