allow-create.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <div style="flex: auto">
  3. <div>
  4. <el-select-v2 v-model="value1" :options="options" placeholder="Please select" style="width: 240px; margin-right: 16px; vertical-align: middle" allow-create filterable multiple clearable />
  5. <el-select-v2 v-model="value2" :options="options" placeholder="Please select" style="width: 240px; vertical-align: middle" allow-create filterable clearable />
  6. </div>
  7. <div>
  8. <p style="margin-top: 20px; margin-bottom: 8px">set reserve-keyword false</p>
  9. <el-select-v2
  10. v-model="value3"
  11. :options="options"
  12. placeholder="Please select"
  13. style="width: 240px; margin-right: 16px; vertical-align: middle"
  14. allow-create
  15. filterable
  16. multiple
  17. clearable
  18. :reserve-keyword="false"
  19. />
  20. </div>
  21. </div>
  22. </template>
  23. <script lang="ts" setup>
  24. import { ref } from 'vue'
  25. const initials = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
  26. const value1 = ref([])
  27. const value2 = ref()
  28. const value3 = ref([])
  29. const options = Array.from({ length: 1000 }).map((_, idx) => ({
  30. value: `Option ${idx + 1}`,
  31. label: `${initials[idx % 10]}${idx}`,
  32. }))
  33. </script>