diff --git a/src/App.vue b/src/App.vue index 6398a1bd88c6a8d75060179436bba923c0a3e463..c8338b9d23c78bce2eb628fd435ac8388549c588 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 46a054eddbbb7814a5b4973df87ed85059b3831e..a459e016c132226a59a3219b72af7ad45e0490c7 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') + } + } } }