[Vuejs]-Categorizing HTML Select

0👍

You can use optgroup as suggested and have it look like this.

Assuming you have a category level to you model

<div class="col-xl-7">
 <select size="sm" class="form-control m-input m-input--air" v-model="programDetailID">
  <!-- Add a category for loop here -->
  <optgroup v-for="category in categories" :label="category.name">
   <option v-if="checkProg==true" v-for="program in category.modelProgram" :value="program.programDetailID">{{program.description}}</option>
  </optgroup>
 </select>

Leave a comment