From c639dc2028f00845d1cb96b230060cf20de61347 Mon Sep 17 00:00:00 2001 From: Justineo Date: Fri, 22 Oct 2021 01:08:42 +0800 Subject: [PATCH] fix: fix version target highlight on soft navigations --- plugins/target.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/target.js b/plugins/target.js index 3d699bf..7d75090 100644 --- a/plugins/target.js +++ b/plugins/target.js @@ -8,7 +8,7 @@ function clearTarget () { delete target.dataset.target } -export default ({ app, route }) => { +export default ({ app }) => { document.documentElement.addEventListener('click', clearTarget) app.router.afterEach(to => { @@ -27,7 +27,7 @@ export default ({ app, route }) => { if (anchor.tagName === 'CODE') { target = anchor.closest('tr') - } else if (route.name === 'changelog' && anchor.tagName === 'H2') { + } else if (app.router.currentRoute.name === 'changelog' && anchor.tagName === 'H2') { target = anchor.closest('.version-item') }