fix: fix version target highlight on soft navigations

This commit is contained in:
Justineo 2021-10-22 01:08:42 +08:00
parent 047867d72a
commit c639dc2028
No known key found for this signature in database
GPG Key ID: B73F0979CF18A0EA

View File

@ -8,7 +8,7 @@ function clearTarget () {
delete target.dataset.target delete target.dataset.target
} }
export default ({ app, route }) => { export default ({ app }) => {
document.documentElement.addEventListener('click', clearTarget) document.documentElement.addEventListener('click', clearTarget)
app.router.afterEach(to => { app.router.afterEach(to => {
@ -27,7 +27,7 @@ export default ({ app, route }) => {
if (anchor.tagName === 'CODE') { if (anchor.tagName === 'CODE') {
target = anchor.closest('tr') 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') target = anchor.closest('.version-item')
} }