grouping.vue 672 B

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