disabled-option.vue 639 B

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