From 696de454eaa78bea3027a8dee398b5e24b8e588a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no> Date: Fri, 28 Feb 2020 15:39:02 +0100 Subject: [PATCH] fikset noen problemer med historikk og definisjonsID --- src/App.vue | 1 + src/components/Definition.vue | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index 6398a1b..c8338b9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -104,6 +104,7 @@ export default { var self = this if (this.article.article_id == item.article_id){ this.article_key++ + history.replaceState({article: this.article, search_results: this.search_results, lang: this.lang}, '') }else{ self.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}} self.waiting = true diff --git a/src/components/Definition.vue b/src/components/Definition.vue index 46a054e..a459e01 100644 --- a/src/components/Definition.vue +++ b/src/components/Definition.vue @@ -44,14 +44,24 @@ var Definition = { mounted: function()Â { let ref = 'def' + this.body.id if(location.hash.substring(1) == ref){ - this.$refs[ref].scrollIntoView() - this.$refs[ref].classList.add('highlighted') + this.$refs[ref].scrollIntoView() + this.$refs[ref].classList.add('highlighted') } }, methods: { article_link_click: function(item) { this.$emit('article-click', item) } + }, + watch:{ + $route(to, from) { + let ref = 'def' + this.body.id + if(location.hash.substring(1) == ref){ + this.$refs[ref].classList.add('highlighted') + }else{ + this.$refs[ref].classList.remove('highlighted') + } + } } } -- GitLab