Skip to content

Commit

Permalink
fix: ref may be called after destroyed
Browse files Browse the repository at this point in the history
close: #414
  • Loading branch information
Ernest committed Mar 17, 2022
1 parent 3a0de25 commit 3869b6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ const VueSelect = defineComponent({
}
context.emit('search:focus')
} else {
wrapper.value.focus()
wrapper.value?.focus()
}
} else {
if (props.searchable) {
Expand All @@ -326,7 +326,7 @@ const VueSelect = defineComponent({
if (props.clearOnClose) clearInput()
context.emit('search:blur')
} else {
wrapper.value.blur()
wrapper.value?.blur()
}
context.emit('closed')
context.emit('blur')
Expand All @@ -339,9 +339,9 @@ const VueSelect = defineComponent({
isFocusing.value = true
}
const blur = (e?) => {
if (wrapper.value.contains(e?.relatedTarget)) {
if (wrapper.value?.contains(e?.relatedTarget)) {
setTimeout(() => {
wrapper.value.focus()
wrapper.value?.focus()
})
return
}
Expand Down

0 comments on commit 3869b6b

Please sign in to comment.