import { Component, createMemo, createSignal } from "solid-js"; import { useLocation } from "@solidjs/router"; // 导入组件以注册自定义元素 import "./components"; import { Article, MobileSidebar, DesktopSidebar } from "./components"; const App: Component = () => { const location = useLocation(); const [isSidebarOpen, setIsSidebarOpen] = createSignal(false); const currentPath = createMemo(() => { // 根据路由加载对应的 markdown 文件 let path = decodeURIComponent(location.pathname); if (!path) path = "/content/"; if (path.endsWith("/")) path += "index"; if (!path.endsWith(".md")) path += ".md"; return path; }); return (
{/* 桌面端固定侧边栏 */} {/* 移动端抽屉式侧边栏 */} setIsSidebarOpen(false)} />
{/* 仅在移动端显示菜单按钮 */}

TTRPG Tools

); }; export default App;