[Vuejs]-Render images with Vue.js and Django

0👍

Seems like you need to have an <img /> tag in your Vue template and then iterate over the photos (which should be an array) binding the :src to the photo url string, and the :key to a unique id or index.

Something like

<div class="column is-10">
    <template v-if="$store.state.user.isAuthenticated">
        <template v-if="activeLesson">
            <h2>{{ activeLesson.title }}</h2>
            
            {{ activeLesson.long_description }}
            <img v-for="(photo, index) in activeLesson.photos" :src="photo.url" :key="index" />

            <hr>

Leave a comment