@vuepress/plugin-redirect 2.0.0-rc.28 → 2.0.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { usePreferredLanguages, useScrollLock, useSessionStorage, } from '@vueuse/core';
|
|
2
|
-
import { computed, defineComponent, h, nextTick, onBeforeUnmount, onMounted, ref, TransitionGroup, } from 'vue';
|
|
3
|
-
import {
|
|
2
|
+
import { computed, defineComponent, h, nextTick, onBeforeUnmount, onMounted, ref, TransitionGroup, watch, } from 'vue';
|
|
3
|
+
import { useRouteLocale, useRoutePath, useRouter } from 'vuepress/client';
|
|
4
4
|
import { redirectLocaleConfig, redirectLocaleEntries } from '../define.js';
|
|
5
5
|
import '../styles/redirect-modal.css';
|
|
6
6
|
const redirectLocales = __REDIRECT_LOCALES__;
|
|
@@ -10,8 +10,8 @@ export default defineComponent({
|
|
|
10
10
|
name: 'RedirectModal',
|
|
11
11
|
setup() {
|
|
12
12
|
const languages = usePreferredLanguages();
|
|
13
|
-
const route = useRoute();
|
|
14
13
|
const router = useRouter();
|
|
14
|
+
const routePath = useRoutePath();
|
|
15
15
|
const routeLocale = useRouteLocale();
|
|
16
16
|
const body = ref();
|
|
17
17
|
// lock body scroll when modal is displayed
|
|
@@ -48,13 +48,15 @@ export default defineComponent({
|
|
|
48
48
|
return null;
|
|
49
49
|
});
|
|
50
50
|
const redirect = () => {
|
|
51
|
-
|
|
52
|
-
router.replace(route.path.replace(routeLocale.value, info.value.localePath));
|
|
51
|
+
router.replace(routePath.value.replace(routeLocale.value, info.value.localePath));
|
|
53
52
|
};
|
|
53
|
+
watch(routePath, () => {
|
|
54
|
+
showModal.value = false;
|
|
55
|
+
});
|
|
54
56
|
onMounted(async () => {
|
|
55
57
|
body.value = document.body;
|
|
56
58
|
await nextTick();
|
|
57
|
-
if (!redirectStatusStorage.value[routeLocale.value]) {
|
|
59
|
+
if (!redirectStatusStorage.value[routeLocale.value] && info.value) {
|
|
58
60
|
if (switchLocale === 'direct')
|
|
59
61
|
redirect();
|
|
60
62
|
else if (switchLocale === 'modal')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/plugin-redirect",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.30",
|
|
4
4
|
"description": "VuePress plugin - redirect",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-plugin",
|
|
@@ -42,16 +42,19 @@
|
|
|
42
42
|
"style": "sass src:lib --no-source-map"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vuepress/helper": "~2.0.0-rc.
|
|
45
|
+
"@vuepress/helper": "~2.0.0-rc.30",
|
|
46
46
|
"@vueuse/core": "^10.9.0",
|
|
47
47
|
"cac": "^6.7.14",
|
|
48
48
|
"vue": "^3.4.27"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"vuepress": "2.0.0-rc.
|
|
51
|
+
"vuepress": "2.0.0-rc.11"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"sass": "^1.77.1"
|
|
52
55
|
},
|
|
53
56
|
"publishConfig": {
|
|
54
57
|
"access": "public"
|
|
55
58
|
},
|
|
56
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "e84a9e154e119525784f6934f06a795029798f8f"
|
|
57
60
|
}
|