Skip to content

Commit

Permalink
修复兼容性跳转问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yunnysunny committed Jan 21, 2024
1 parent 7765375 commit 585a636
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions text/.vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ export default ({
return
}
console.log(siteData)
console.log('test==',location.href)
const hash = location.hash
const pages = siteData.pages
if (hash) {
for (let i = 0, len = pages.length; i < len; i++) {
const path = pages[i].regularPath
if ('#' + path === hash) {
location.href = siteData.base + path
const name = path.slice(0, -'.html'.length)
if ('#' + name === hash) {
const url = siteData.base + path.substring(1)
console.log('navigate to ', url)
location.href = url
break
}
}
Expand Down

0 comments on commit 585a636

Please sign in to comment.