Skip to content

Commit dfabac8

Browse files
committed
修正giscus路径错误
1 parent 05bfdd1 commit dfabac8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

text/.vuepress/enhanceApp.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ function updateGiscus(path) {
77
);
88
}
99
}
10+
function getPath(pathWithHash) {
11+
return pathWithHash.split('#')[0]
12+
}
1013
function addHistoryEvent() {
1114
const _historyWrap = function(type) {
1215
const orig = history[type];
@@ -23,11 +26,11 @@ function addHistoryEvent() {
2326

2427
window.addEventListener('pushState', function(e) {
2528
console.log('change pushState', e);
26-
updateGiscus(e.arguments[2])
29+
updateGiscus(getPath(e.arguments[2]))
2730
});
2831
window.addEventListener('replaceState', function(e) {
2932
console.log('change replaceState', e);
30-
updateGiscus(e.arguments[2])
33+
updateGiscus(getPath(e.arguments[2]))
3134
});
3235
}
3336

0 commit comments

Comments
 (0)