grouping.vue 662 B

12345678910111213141516171819202122232425262728
  1. <template>
  2. <el-select-v2
  3. v-model="value"
  4. filterable
  5. :options="options"
  6. placeholder="Please select"
  7. style="width: 240px"
  8. multiple
  9. />
  10. </template>
  11. <script lang="ts" setup>
  12. import { ref } from 'vue'
  13. const initials = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
  14. const value = ref([])
  15. const options = Array.from({ length: 10 }).map((_, idx) => {
  16. const label = idx + 1
  17. return {
  18. value: `Group ${label}`,
  19. label: `Group ${label}`,
  20. options: Array.from({ length: 10 }).map((_, idx) => ({
  21. value: `Option ${idx + 1 + 10 * label}`,
  22. label: `${initials[idx % 10]}${idx + 1 + 10 * label}`,
  23. })),
  24. }
  25. })
  26. </script>