Skip to content

Commit

Permalink
fix: the search query is not synchronized with the input value (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanxxx authored Apr 1, 2024
1 parent 2d16e5e commit d54c323
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/IconSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,19 @@ watch(
onMounted(() => {
search.value = route.query.s as string || ''
watch([search, collection], () => {
watch([search], () => {
synchronizeSearchQuery()
})
watch([collection], () => {
if (search.value)
router.replace({ query: { s: search.value } })
synchronizeSearchQuery()
})
})
function synchronizeSearchQuery() {
router.replace({ query: { s: search.value } })
}
function focusSearch() {
searchbar.value?.input.focus()
}
Expand Down

0 comments on commit d54c323

Please sign in to comment.