J
J
Jussss922021-08-10 17:49:29
Vue.js
Jussss92, 2021-08-10 17:49:29

How to convert string to src?

Hello.
I have a question.
There are pictures (which are output by v-for src cycles.
If you statically display the path src='assets/1.img' then everything is OK.
If, for example, I want to generate a path through computed or a filter, then a string is returned.
Therefore, I do: src=' computed.property '

And that doesn't work anymore, so how do you dynamically substitute the path?

<q-img
         :src="name | srcImg(name)"
     />


and this is the filter code

if (value) {
    value = value.trim().toLowerCase()
  }
  return `~assets/vendors/${value}.jpg`

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Anton, 2021-08-10
@Fragster

https://quasar.dev/quasar-cli/handling-assets#gett...
Well, the operator | :srcclearly out of place .

A
azemlyankin, 2021-08-10
@azemlyankin

:src=`${computed.property} `

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question