diff --git a/src/components/Article.vue b/src/components/Article.vue index e6ed4536f2a8d507bba084e7253e65ef24fce3e1..2832ecca9f89f319a465610ed3e106d8886f3696 100644 --- a/src/components/Article.vue +++ b/src/components/Article.vue @@ -131,7 +131,12 @@ export default { }, mounted: function() { if (this.$route.hash == "#"+ this.title_id) { - document.getElementById(this.title_id).focus() + let focused = document.getElementById(this.title_id) + if (focused) focused.focus() + } + else if (this.$route.hash) { + let focused =document.getElementById(this.$route.hash.replace("#","")) + if (focused) focused.scrollIntoView({block: "center"}) } }, methods: {