use-valueKey.vue 564 B

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