I have created 5 checkboxes dynamically through for loop
<v-checkbox
v-model="selectAll"
label="Select All"
@change="select_All($event)"
></v-checkbox>
<template v-for="n in 5">
<v-checkbox
v-model="selected[n]"
></v-checkbox>
</template>
In script
data(){
return{
selected:[],
selectAll: false
}
},
methods:{
select_All(e){
if(e == true)
{
// check all the checkbox
} else {
// uncheck all the checkbox
}
}
}
This is how I have created checkboxes dynamically,(if you have any better suggestion for how to create dynamic checkbox please tell me) Now I have a checkbox above all and if I click(check) on that checkbox all the below checkbox should be selected or vice-versa.