File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import { debounce } from ' perfect-debounce'
3-
42const router = useRouter ()
53const searchQuery = ref (' ' )
64const searchInputRef = useTemplateRef (' searchInputRef' )
75const { focused : isSearchFocused } = useFocus (searchInputRef )
86
9- const debouncedNavigate = debounce (() => {
7+ function handleSearch() {
108 router .push ({
11- path: ' /search' ,
12- query: searchQuery .value .trim () ? { q: searchQuery .value .trim () } : undefined ,
9+ name: ' search' ,
10+ query: {
11+ q: searchQuery .value .trim (),
12+ },
1313 })
14- }, 250 )
15-
16- function handleSearch() {
17- // If input is empty, navigate immediately (no need to debounce)
18- return searchQuery .value .trim () ? debouncedNavigate () : router .push (' /search' )
1914}
2015
2116useSeoMeta ({
@@ -78,7 +73,6 @@ defineOgImageComponent('Default')
7873 v-bind =" noCorrect"
7974 autofocus
8075 class =" w-full bg-bg-subtle border border-border rounded-lg ps-8 pe-24 py-4 font-mono text-base text-fg placeholder:text-fg-subtle transition-border-color duration-300 focus:border-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50"
81- @input =" handleSearch"
8276 />
8377
8478 <button
You can’t perform that action at this time.
0 commit comments