Skip to content

Commit 1865d24

Browse files
committed
修改examples中英文切换hash丢失的问题
1 parent 697c0b6 commit 1865d24

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/js/common.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
function localize() {
8080
var lang = utils.getLanguage();
8181
var pathname = window.location.pathname.replace("/en/", "/");
82+
var hash = window.location.hash;
8283
var href = window.location.origin + pathname;
8384
if (lang === "en-US") {
8485
if (getVersion()) {
@@ -92,10 +93,10 @@
9293
}
9394

9495
}
95-
if ((window.location.origin + window.location.pathname) === href) {
96+
if ((window.location.origin + window.location.pathname+hash) === href+hash) {
9697
return;
9798
}
98-
window.location = href;
99+
window.location = href+hash;
99100
}
100101

101102
function getCommonScriptPath() {

0 commit comments

Comments
 (0)