[Vuejs]-Vue Js displaying object in qoutes

1πŸ‘

βœ…

To use image routes in this way you must first import them for Webpack to be able to process them from the data:

import mathImg from  "../assets/Math.png"

// in your data
Lessons: [
        {
          url: mathImg, // use the import name
          Title: "Lesson",
          Subject: "Math",
          Location: "London",
          Price: "Β£100",
          Spaces: 5,
        }
]

in your template

<img :src="Lessons.url" />
πŸ‘€innerurge1

1πŸ‘

I believe you want to bind the src attribute like so:

<img :src="lesson.url" ...>

1πŸ‘

I guess you forgot the :

  <img :src="`${lesson.url}`" alt="" class="card-img-top img-fluid">

and you also can

 <img :src="lesson.url" alt="" class="card-img-top img-fluid">
πŸ‘€rb_19

Leave a comment