0

I want show image using url from the db.

Like this

<img class="card-img" src="{{travel.city}}" alt="Card image">

{{travel.city}} is a variable from v-for loop. this v-foor loop is working.

1
  • Is the img element rendering? Commented Aug 20, 2018 at 19:28

2 Answers 2

2

Use v-bind directive:

<img v-bind:src="travel.city">

Or short:

<img :src="travel.city">

Hope this will help you :)

Sign up to request clarification or add additional context in comments.

Comments

1

Try using the syntax for attribute binding instead:

<img class="card-img" :src="travel.city" alt="Card image">

Vue doesn't support interpolation of mustache-style templates in attributes (like Angular or other frameworks do).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.