Insert a image in on column in my table
-
How can I insert an image on one row of my table? I have tried to put v-if in my loop through the columns but I cannot get it right. I am pretty new to quasar so I might confuse things. My idea was to use the v-if for checking if the column name is ‘Image’ insert an image. And only in that column
My columns are Name, Age and Image
Here is my code:
<template v-slot:body="props"> <div class="row-spacing"></div> <q-tr :props="props" :class="tableFormat(props.row)" @click="onRowClick($event, props.row)" > <q-td class="td-my" v-for="col in props.cols" :key="col.name" :props="props" >{{ col.value }} <div v-if="col.name === 'Image'"> <img class="profile-img" :src="profileimg[0].url" /> </div> </q-td> </q-tr> </template>
-
Here’s a codepen
https://codepen.io/ontwikkelfabriek/pen/ExgagbBI used this demo:
https://quasar.dev/vue-components/table#Body-slots