diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index 065016dedeccb0909266f79d35d191714984f83a..4bfad830655c506f4e187d740ea8bd2156fd1b28 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -2,7 +2,7 @@ <main> <div class="search_container"> <div class="lang_select_container"> - <v-radio-group row v-model="lang"> + <v-radio-group row v-model="lang" @change="force_rerender"> <template v-slot:label> <span>VIS</span> </template> @@ -37,6 +37,7 @@ </div> <SearchResults :hits="search_results" :lang="lang" + :key="lang" @article-click="article_link_click" @details-click="details_click" v-if="search_results.length && ! waiting && ! article" /> @@ -177,7 +178,8 @@ export default { article: null, error: null, monthly_bm: null, - monthly_nn: null + monthly_nn: null, + event: null } }, computed: { @@ -195,9 +197,11 @@ export default { }, methods: { select_result: function(event) { + this.event = event if(event.articles){ let source = '/' + this.lang + '/w/' + event.word 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.article = null this.error = null @@ -211,6 +215,15 @@ export default { this.$plausible.trackEvent('dropdown selection', {props: {query: event.label, match: '<fritekstsøk>'}}) } }, + force_rerender: function(event) { + if (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) { if (this.article && this.article.article_id == item.article_id){ this.article_key++