disabled-option.vue 677 B

12345678910111213141516171819202122232425262728293031323334
  1. <template>
  2. <el-select v-model="value" placeholder="Select">
  3. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" :disabled="item.disabled" />
  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. disabled: true,
  18. },
  19. {
  20. value: 'Option3',
  21. label: 'Option3',
  22. },
  23. {
  24. value: 'Option4',
  25. label: 'Option4',
  26. },
  27. {
  28. value: 'Option5',
  29. label: 'Option5',
  30. },
  31. ]
  32. </script>