Skip to content

Commit

Permalink
修正giscus路径错误
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyang2024 committed May 2, 2024
1 parent 05bfdd1 commit dfabac8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions text/.vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ function updateGiscus(path) {
);
}
}
function getPath(pathWithHash) {
return pathWithHash.split('#')[0]
}
function addHistoryEvent() {
const _historyWrap = function(type) {
const orig = history[type];
Expand All @@ -23,11 +26,11 @@ function addHistoryEvent() {

window.addEventListener('pushState', function(e) {
console.log('change pushState', e);
updateGiscus(e.arguments[2])
updateGiscus(getPath(e.arguments[2]))
});
window.addEventListener('replaceState', function(e) {
console.log('change replaceState', e);
updateGiscus(e.arguments[2])
updateGiscus(getPath(e.arguments[2]))
});
}

Expand Down

0 comments on commit dfabac8

Please sign in to comment.