1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-23 04:42:24 +03:00

Fixed searching when user is already at search page

This commit is contained in:
Avele 2019-07-08 19:36:46 +04:00
parent 8c0bfbbefc
commit 82363d9705

View File

@ -83,6 +83,7 @@ export default class SearchResults extends Vue {
}
beforeMount () {
// This watch should be added in beforeMount (only on client) hook because setDocumentTitle function uses DOM api which is undefined on server
this.$watch('query', this.setDocumentTitle, { immediate: true })
}
@ -91,6 +92,11 @@ export default class SearchResults extends Vue {
}
async serverPrefetch () {
await this.search()
}
@Watch('query')
async search () {
await this.$store.dispatch('wiki/search', this.query)
}