diff --git a/docs/.vitepress/vitepress/components/vp-app.vue b/docs/.vitepress/vitepress/components/vp-app.vue index fc6afaaa01..e85ca28c06 100644 --- a/docs/.vitepress/vitepress/components/vp-app.vue +++ b/docs/.vitepress/vitepress/components/vp-app.vue @@ -17,11 +17,16 @@ import VPSponsors from './vp-sponsors.vue' import VPReloadPrompt from './vp-reload-prompt.vue' const USER_PREFER_GITHUB_PAGE = 'USER_PREFER_GITHUB_PAGE' - const [isSidebarOpen, toggleSidebar] = useToggle(false) const { hasSidebar } = useSidebar() const lang = useLang() +const mirrorUrl = 'element-plus.gitee.io' +const isMirrorUrl = () => { + if (!isClient) return + return window.location.hostname === mirrorUrl +} + useToggleWidgets(isSidebarOpen, () => { if (!isClient) return if (window.outerWidth >= breakpoints.lg) { @@ -63,7 +68,7 @@ onMounted(async () => { ) if (lang.value === 'zh-CN') { - if (location.host === 'element-plus.gitee.io') return + if (isMirrorUrl()) return if (userPrefer.value) { // no alert in the next 90 days @@ -130,7 +135,7 @@ onMounted(async () => { - +