You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
745 B

  1. <template>
  2. <v-combobox
  3. v-model="chips"
  4. :items="labels"
  5. chips
  6. clearable
  7. label="Label"
  8. multiple
  9. >
  10. <template v-slot:selection="{ attrs, item, select, selected }">
  11. <v-chip
  12. v-bind="attrs"
  13. :input-value="selected"
  14. close
  15. @click="select"
  16. @click:close="remove(item)"
  17. >
  18. {{ item }}
  19. </v-chip>
  20. </template>
  21. </v-combobox>
  22. </template>
  23. <script>
  24. export default {
  25. props: {
  26. labels: {
  27. type: Array,
  28. default: () => [],
  29. required: true
  30. }
  31. },
  32. data() {
  33. return {
  34. chips: []
  35. }
  36. },
  37. methods: {
  38. remove(item) {
  39. this.chips.splice(this.chips.indexOf(item), 1)
  40. this.chips = [...this.chips]
  41. }
  42. }
  43. }
  44. </script>