Skip to content

Commit

Permalink
feat(taginput): add removeItem as selected slot property (#887) (#888)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivo van Heel <heel@glr.nl>
  • Loading branch information
Thaurin and Ivo van Heel authored Apr 13, 2024
1 parent ad863a0 commit c8c26cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ function getType(item) {
v-model="items"
icon="tag"
placeholder="Add an item">
<template #selected="{ items }">
<template #selected="{ items, removeItem }">
<o-button
v-for="(item, index) in items"
:key="index"
:label="item"
native-type="button"
:variant="getType(item)"
rounded
@click="$refs.input.removeItem(index, $event)" />
@click="removeItem(index, $event)" />
</template>
</o-taginput>
</o-field>
Expand Down
2 changes: 1 addition & 1 deletion packages/oruga/src/components/taginput/Taginput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ defineExpose({ focus: setFocus });
@slot Override selected items
@binding {unknown[]} items - selected items
-->
<slot name="selected" :items="items">
<slot name="selected" :items="items" :remove-item="removeItem">
<span
v-for="(item, index) in items"
:key="getNormalizedItemText(item) + index"
Expand Down

0 comments on commit c8c26cc

Please sign in to comment.