K
K
kroha30002019-11-02 11:52:23
Vue.js
kroha3000, 2019-11-02 11:52:23

How to display a list on vue in a tag?

The question is probably stupid as hell.
I want to remove images from the list.
the list contains only filenames.

data: {
    items: [
      { namefile: 'v-123' },
      { namefile: 'v-124' },
      { namefile: 'v-125' },
      { namefile: 'v-126' },
      { namefile: 'v-127' },
      { namefile: 'v-128' }
    ]
  }

{{ item.namefile }} - выводит название. Всё норм.
But I just insert it into the structure:
<img src="@/assets/images/{{ item.namefile }}.jpg">

All wrong. I looked through the documentation and can't find anything. with English trouble, and Russian documentation, for some reason the site has not been opened for a couple of days .... Tell me how to insert it. I understand it's a syntax error. But I've already tried a lot of things, nothing really comes out :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin B., 2019-11-02
@kroha3000

<img :src="’@/assets/images/${ item.namefile }.jpg’">

Dynamic attributes are specified with a colon. This is a shorthand for v-bind
If you cheated the dock you would know this
. PS The single quotes in the example should be reversed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question