Skip to content
Snippets Groups Projects
Commit 2ca700d0 authored by Petr Kalashnikov's avatar Petr Kalashnikov
Browse files

Fix search after page update

parent dad4bea9
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<main> <main>
<div class="search_container"> <div class="search_container">
<div class="lang_select_container"> <div class="lang_select_container">
<v-radio-group row v-model="lang" @change="forceRerender"> <v-radio-group row v-model="lang" @change="force_rerender">
<template v-slot:label> <template v-slot:label>
<span>VIS</span> <span>VIS</span>
</template> </template>
...@@ -198,11 +198,10 @@ export default { ...@@ -198,11 +198,10 @@ export default {
methods: { methods: {
select_result: function(event) { select_result: function(event) {
this.event = event this.event = event
if(!event){ if(event.articles){
return false
}else if(event.articles){
let source = '/' + this.lang + '/w/' + event.word let source = '/' + this.lang + '/w/' + event.word
this.$router.push(source) this.$router.push(source)
console.log(this.$router)
this.search_results = event.articles.sort(compare_by_hgno(decodeURIComponent(event.word))).map(a => Object.assign(a, {source: source})) this.search_results = event.articles.sort(compare_by_hgno(decodeURIComponent(event.word))).map(a => Object.assign(a, {source: source}))
this.article = null this.article = null
this.error = null this.error = null
...@@ -216,9 +215,14 @@ export default { ...@@ -216,9 +215,14 @@ export default {
this.$plausible.trackEvent('dropdown selection', {props: {query: event.label, match: '<fritekstsøk>'}}) this.$plausible.trackEvent('dropdown selection', {props: {query: event.label, match: '<fritekstsøk>'}})
} }
}, },
forceRerender: function(event) { force_rerender: function(event) {
if (this.event){this.event.articles = null} if (this.event){
this.select_result(this.event) this.event.articles = null
this.select_result(this.event)
}
else{
navigate_to_search(this, this.$router.history.current.params.word)
}
}, },
article_link_click: function(item) { article_link_click: function(item) {
if (this.article && this.article.article_id == item.article_id){ if (this.article && this.article.article_id == item.article_id){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment