diff --git a/src/.vuepress/components/SearchInput.vue b/src/.vuepress/components/SearchInput.vue index 053162482bbedbe821f8e3503796d74446459f54..b11e3addf90b499119277fa6fde7a2f4ba0d404f 100644 --- a/src/.vuepress/components/SearchInput.vue +++ b/src/.vuepress/components/SearchInput.vue @@ -76,15 +76,10 @@ export default { keyboardLayouts: ['arabic', 'syriac'] } }, - watch:{ - '$route.query': { - handler(query) { - if (query.searchTerm) { - this.input = query.searchTerm; - } - }, - immediate: true, - }, + mounted(){ + if(this.$route.query?.searchTerm){ + this.input = this.$route.query.searchTerm; + } }, methods: { onSubmit(e) { diff --git a/src/.vuepress/components/SearchPage.vue b/src/.vuepress/components/SearchPage.vue index 76bc422dfc9f928b922af3acf2a48d968117f344..4458bbf21a0dbc835a5d9d9c837ceada453edc47 100644 --- a/src/.vuepress/components/SearchPage.vue +++ b/src/.vuepress/components/SearchPage.vue @@ -64,14 +64,6 @@ export default { } }, watch:{ - '$route.query': { - handler(query) { - if (query.searchTerm) { - this.onSearchInput(query.searchTerm); - } - }, - immediate: true, - }, page: function() { this.loading = true; @@ -79,6 +71,11 @@ export default { this.search(this.query.trim(), from, this.size); } }, + mounted(){ + if(this.$route.query?.searchTerm){ + this.onSearchInput(this.$route.query.searchTerm); + } + }, computed: { invalid() { return this.query.match(/^\s*$/);