From b88b29b745288d4f2495140f1e3a5b2214821072 Mon Sep 17 00:00:00 2001 From: v6ole Date: Fri, 26 Jun 2026 15:56:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=8B=E5=8A=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E5=A4=B1=E6=95=88=20=E2=80=94=20=E4=BB=85?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=87=AA=E5=8A=A8=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 只对根路径 / 做手机→/m 跳转,不再拦截桌面访问 /m - 支持 ?view=desktop 或 ?view=mobile 强制覆盖自动检测 - 手动输入的具体路径完全不受影响 Co-Authored-By: Claude --- frontend/src/router/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 919b292..6cd06b8 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -75,16 +75,16 @@ router.beforeEach((to, _from, next) => { return } - // Auto-redirect to mobile layout for mobile devices accessing desktop routes - const onMobile = isMobile() - if (onMobile && to.path === '/' && !to.path.startsWith('/m')) { - next('/m') - return - } - // Desktop user accidentally on mobile route → redirect to desktop - if (!onMobile && to.path.startsWith('/m')) { - next('/') - return + // Auto-redirect: mobile devices hitting root → send to mobile home + // Allow manual override via ?view=desktop or ?view=mobile + const viewOverride = to.query.view as string + if (!viewOverride) { + const onMobile = isMobile() + // Only redirect bare root — explicit paths are honored + if (onMobile && (to.path === '/' || to.path === '')) { + next('/m') + return + } } next()