File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33</template >
44
55<script setup lang="ts">
6- import { DocSearch , DocSearchOptions } from ' @vuepress/plugin-docsearch/client' ;
6+ import { DocSearch } from ' @vuepress/plugin-docsearch/client' ;
77import {
88 useDebounceFn ,
99 useElementVisibility ,
@@ -22,10 +22,13 @@ const inputElement = ref<HTMLInputElement>();
2222const isNavigating = ref (false );
2323
2424// Handle initial search query, if one is set
25- onMounted (async () => {
25+ onMounted (() => {
2626 const query = new URL (window .location .href ).searchParams .get (SEARCH_KEY );
2727 if (query ) {
28- (document .querySelector (' .DocSearch-Button' ) as HTMLButtonElement ).click ();
28+ const button =
29+ document .querySelector <HTMLButtonElement >(' .DocSearch-Button' );
30+ if (! button ) return ;
31+ button .click ();
2932 // Set value in the input element once it appears
3033 performInitialQuery (query );
3134 }
Original file line number Diff line number Diff line change 2020 "@vuepress/plugin-shiki" : " 2.0.0-rc.118" ,
2121 "@vuepress/plugin-sitemap" : " 2.0.0-rc.118" ,
2222 "@vuepress/theme-default" : " 2.0.0-rc.118" ,
23+ "@vueuse/core" : " ^14.0.0" ,
2324 "asciinema-player" : " ^3.15.1" ,
2425 "cross-env" : " ^10.1.0" ,
2526 "lefthook" : " 1.8.2" ,
You can’t perform that action at this time.
0 commit comments