allow-create.vue 615 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <el-select
  3. v-model="value"
  4. multiple
  5. filterable
  6. allow-create
  7. default-first-option
  8. :reserve-keyword="false"
  9. placeholder="Choose tags for your article"
  10. >
  11. <el-option
  12. v-for="item in options"
  13. :key="item.value"
  14. :label="item.label"
  15. :value="item.value"
  16. />
  17. </el-select>
  18. </template>
  19. <script lang="ts" setup>
  20. import { ref } from 'vue'
  21. const value = ref<string[]>([])
  22. const options = [
  23. {
  24. value: 'HTML',
  25. label: 'HTML',
  26. },
  27. {
  28. value: 'CSS',
  29. label: 'CSS',
  30. },
  31. {
  32. value: 'JavaScript',
  33. label: 'JavaScript',
  34. },
  35. ]
  36. </script>