Skip to content

Commit fbce33b

Browse files
committed
fix: fix version switch again again
1 parent 3985715 commit fbce33b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,21 @@ function refresh() {
2424
2525
for (const v of versionList) {
2626
if (window.location.pathname.startsWith(`/${v}/`)) {
27-
if (currentVersion.value !== '' && v !== currentVersion.value) {
28-
refreshPage = true;
29-
}
3027
version = v;
3128
isLatest.value = false;
3229
break;
3330
}
3431
}
3532
33+
if (currentVersion.value !== version) {
34+
refreshPage = true;
35+
}
36+
3637
currentVersion.value = version;
3738
versions.value = versionList;
3839
3940
if (refreshPage) {
41+
window.location.pathname = isLatest.value ? '/' : `/${version}/`;
4042
window.location.reload();
4143
}
4244
}

0 commit comments

Comments
 (0)