Skip to content

Commit cc00018

Browse files
committed
fix: fix version switch
1 parent 71969b4 commit cc00018

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/.vitepress/theme/versioning/VersionSwitcher.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,24 @@ const versions = ref<string[]>([]);
1818
1919
function refresh() {
2020
let version = latestVersion.value;
21+
let refreshPage = false;
2122
2223
for (const v of versionList) {
2324
if (window.location.pathname.startsWith(`/${v}/`)) {
25+
if(currentVersion.value !== '' && v !== currentVersion.value) {
26+
refreshPage = true;
27+
}
2428
version = v;
2529
break;
2630
}
2731
}
2832
2933
currentVersion.value = version;
3034
versions.value = versionList;
35+
36+
if(refreshPage) {
37+
window.location.reload();
38+
}
3139
}
3240
3341
async function init() {

0 commit comments

Comments
 (0)