diff options
| author | shu <nvcsadjkojf@outlook.com> | 2026-09-06 19:41:09 +0800 |
|---|---|---|
| committer | shu <nvcsadjkojf@outlook.com> | 2026-09-06 19:41:09 +0800 |
| commit | 4c4215882e16992fdc054d364af2e3a0ef6f1a22 (patch) | |
| tree | 69e3732feb999e786ce5c051ec98a060073d9842 /src | |
| parent | 61c1674e439dd791aee4fdc72e5738bbefed13e9 (diff) | |
新增默认环境配置,通过 VITE_ROUTER_MODE 切换 Hash 与 History 路由,默认使用 Hash;通过 VITE_BASE_URL 配置资源基础路径,默认使用 /。
补充本地环境覆盖、构建方式及部署注意事项文档,保持 .env.local 不纳入版本控制。
桌面侧栏按钮改用 SidebarSimpleIcon,展开时填充、折叠时描边,保留无障碍状态描述。
验证:pnpm lint、pnpm build 和 git diff --check 通过。构建仍有现存的主包超过 500 kB 提示。
Diffstat (limited to 'src')
| -rw-r--r-- | src/layouts/BasicLayout.tsx | 10 | ||||
| -rw-r--r-- | src/router.ts | 8 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index 9851fd4..512da63 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -14,7 +14,7 @@ import { useMantineTheme, } from '@mantine/core' import { useDisclosure, useMediaQuery } from '@mantine/hooks' -import { CaretLeftIcon, CaretRightIcon } from '@phosphor-icons/react' +import { SidebarSimpleIcon } from '@phosphor-icons/react' import { NavLink as RouterNavLink, Outlet, useLocation, useMatches } from 'react-router' import { pageRoutes } from '../routes.ts' import type { PageRoute } from '../routes.ts' @@ -181,9 +181,11 @@ export function BasicLayout() { aria-expanded={sidebarOpened} aria-controls="desktop-navigation" > - {sidebarOpened - ? <CaretLeftIcon size={20} aria-hidden="true" /> - : <CaretRightIcon size={20} aria-hidden="true" />} + <SidebarSimpleIcon + size={20} + weight={sidebarOpened ? 'fill' : 'regular'} + aria-hidden="true" + /> </ActionIcon> <Burger opened={opened} diff --git a/src/router.ts b/src/router.ts index 32870e2..0e6facd 100644 --- a/src/router.ts +++ b/src/router.ts @@ -1,8 +1,12 @@ -import { createBrowserRouter } from 'react-router' +import { createBrowserRouter, createHashRouter } from 'react-router' import { BasicLayout } from './layouts/BasicLayout.tsx' import { pageRoutes } from './routes.ts' -export const router = createBrowserRouter([ +const createRouter = import.meta.env.VITE_ROUTER_MODE === 'history' + ? createBrowserRouter + : createHashRouter + +export const router = createRouter([ { path: '/', Component: BasicLayout, |
