[Vuejs]-Set max number for checkboxes that can be selected for a form in Element-ui?

0👍

This is how you should do it

<template>
   <el-checkbox-group :min="1" :max="max" v-model='optionsSelected'>
    <el-checkbox v-for="(option, index) in options" :key="index">
        {{option}}
    </el-checkbox>
  </el-checkbox-group>
</template>
<script>
     data() {
  return {
    optionsSelected: ['lalala','lololo'],
    options: [],
    max:3,
  },
 async created(){

      const options = await axios.get('your endpoint');
      this.options = options.data;

  }
}
</script>

Leave a comment