clearable.vue 637 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <el-select v-model="value" clearable placeholder="Select">
  3. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  4. </el-select>
  5. </template>
  6. <script lang="ts" setup>
  7. import { ref } from 'vue'
  8. const value = ref('')
  9. const options = [
  10. {
  11. value: 'Option1',
  12. label: 'Option1',
  13. },
  14. {
  15. value: 'Option2',
  16. label: 'Option2',
  17. },
  18. {
  19. value: 'Option3',
  20. label: 'Option3',
  21. },
  22. {
  23. value: 'Option4',
  24. label: 'Option4',
  25. },
  26. {
  27. value: 'Option5',
  28. label: 'Option5',
  29. },
  30. ]
  31. </script>