[Vuejs]-How to add more properties to a slot on Datatables Vuetify 2.0?

0👍

After the response from Vuetify Discord Chennal

We can do something like this to achieve by having a list of column names in the array,

let listOfColumns = ['isActive', 'isUser']
<template v-for="(column, index) in listOfColumns" #[`item.${column}`]="{ item }">
   <v-icon class="font--style" :key="index"> {{ item[column] ? 'done' : 'clear' }} </v-icon>
</template>

Thanks !!!

0👍

Maybe this extended example can help you to figure it out.

Here is the link https://codepen.io/anon/pen/aeVjBK?editors=1010

<template v-slot:item.fat="{ item }">
    <v-icon :color="item.fat > 10 ? 'red' : 'green'">{{ item.fat > 10 ? 'done' : 'clear' }}</v-icon> 
    <span>({{item.fat}}%)</span>
</template>

Leave a comment