diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 19bf6e462ef3d2296490774e14071ab4ac1bb37c..5b5f696c5323b1bed644b04d4cda0f9017627ff4 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -13,7 +13,8 @@ const config = { rel: 'shortcut icon', type: 'image/x-icon', href: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a90b5f95-90ba-4d30-a6a7-cd4d057327db/d23e842c-58fc-4574-998d-17fdc7811cc3.png?v=1556263038788' - }] + }], + ['script', { src: '/js/redirect.js' }] ], locales: { '/': { @@ -42,7 +43,8 @@ const config = { indexName: 'zh-uniapp', appId: 'PQIR5NL8CZ', searchParameters: { hitsPerPage: 50 } - } + }, + isDevelopment: process.env.NODE_ENV === 'development' }, markdown: { // toc: { includeLevel: [1, 2, 3, 4] }, diff --git a/docs/.vuepress/public/js/redirect.js b/docs/.vuepress/public/js/redirect.js new file mode 100644 index 0000000000000000000000000000000000000000..341339683f8b42de60195d1bc2970ee6b8aa8fd6 --- /dev/null +++ b/docs/.vuepress/public/js/redirect.js @@ -0,0 +1,11 @@ +const { host, pathname } = location + +if (host === 'uniapp.dcloud.io') { + var website_ZH = 'https://uniapp.dcloud.net.cn'; + var website_EN = 'https://en.uniapp.dcloud.io'; + var website_finally = + navigator.language.indexOf('zh') !== -1 + ? website_ZH + : website_EN; + window.location.href = website_finally + pathname; +} \ No newline at end of file diff --git a/package.json b/package.json index a732cb117c663ec25d2eaf478d9fb80cd6795ccd..c60787dd37a9b666bbef5fe47e36b339b6e77782 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,6 @@ }, "dependencies": { "@docsearch/js": "^3.1.0", - "vuepress-theme-uni-app-test": "^1.1.5" + "vuepress-theme-uni-app-test": "^1.1.6" } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 0d65610d78edf55145045f50836056f8531ad603..bfb9cf6eecec6adb4caa9a3cb817fa7e73fe5473 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8477,10 +8477,10 @@ vuepress-theme-uni-app-test@^1.1.2: vuepress-plugin-juejin-style-copy "^1.0.4" vuepress-theme-uni-app-test "^1.1.2" -vuepress-theme-uni-app-test@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/vuepress-theme-uni-app-test/-/vuepress-theme-uni-app-test-1.1.5.tgz#6fca8abe2d1a8ff829c088cc25488bf789e09eb7" - integrity sha512-EisN3pqJMYWBHoBP2DSJ3PqoX5veStrnT58JfmeITaYADy+tuFOX0aTkbIvT/xtUt5632tvUBQ+5WRlqq9RlcA== +vuepress-theme-uni-app-test@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/vuepress-theme-uni-app-test/-/vuepress-theme-uni-app-test-1.1.6.tgz#3421ac614064becff36172fb598b7088139233b2" + integrity sha512-nRj3gW7T1eUjIRqyOFIHn6UcUcPS+SfuapBYDE+dBg2nrA3KIUfUBHTbPOOjSeul2wgkGT0C6PDzh69y1Nk4rA== dependencies: "@vuepress/plugin-back-to-top" "^1.9.5" "@vuepress/theme-default" "^1.8.2"