Skip to content

Commit

Permalink
fix(TagsInputRoot): fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ploca14 committed Dec 19, 2024
1 parent fd5ad7d commit fc0d797
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/radix-vue/src/TagsInput/TagsInputRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ provideTagsInputRootContext({
}
if (props.duplicate) {
modelValue.value = [...modelValue.value, payload)
modelValue.value = [...modelValue.value, payload]
return true
}
else {
const exist = modelValue.value.includes(payload)
if (!exist) {
modelValue.value = [...modelValue.value, payload)
modelValue.value = [...modelValue.value, payload]
return true
}
else {
Expand All @@ -142,7 +142,7 @@ provideTagsInputRootContext({
},
onRemoveValue: (index) => {
if (index !== -1)
modelValue.value = [...modelValue.value].splice(index, 1)
modelValue.value = modelValue.value.filter((_, i) => i !== index)
},
onInputKeydown: (event) => {
const target = event.target as HTMLInputElement
Expand All @@ -158,7 +158,7 @@ provideTagsInputRootContext({
if (selectedElement.value) {
const index = collection.findIndex(i => i === selectedElement.value)
modelValue.value = [...modelValue.value].splice(index, 1)
modelValue.value = modelValue.value.filter((_, i) => i !== index)
selectedElement.value = selectedElement.value === lastTag ? collection.at(index - 1) : collection.at(index + 1)
event.preventDefault()
}
Expand Down

0 comments on commit fc0d797

Please sign in to comment.