LogoTanStarter 文档
LogoTanStarter 文档
首页模板介绍代码库快速开始环境配置
网站配置
网站配置导航菜单页脚菜单侧边栏菜单头像按钮社交媒体
部署

功能集成

Cloudflare数据库身份验证邮件邮件订阅存储支付通知分析聊天框联盟营销

功能定制

元数据页面落地页博客组件用户管理密钥管理

代码库

项目结构代码检查编辑器设置更新代码库
X (Twitter)
网站配置

侧边栏菜单

配置仪表盘页面的导航菜单

定义后台管理页面的左侧边栏导航菜单,每个项目都是 MenuItemConfig。

src/config/sidebar-config.ts
export function getSidebarLinks(): MenuItemConfig[] {
  return [
    {
      title: m.dashboard,
      icon: IconLayoutDashboard,
      href: Routes.Dashboard,
      external: false,
    },
    {
      title: am.title,
      icon: IconShieldCheck,
      authorizeOnly: ['admin'],
      items: [
        {
          title: am.users.title,
          icon: IconUsers,
          href: Routes.AdminUsers,
          external: false,
        },
      ],
    },
    {
      title: m.settings,
      icon: IconSettings2,
      items: [
        { title: m.profile, icon: IconUserCircle, href: Routes.SettingsProfile },
        // billing(取决于 payment.enable)
        { title: m.security, icon: IconLock, href: Routes.SettingsSecurity },
        { title: m.files, icon: IconFileUpload, href: Routes.SettingsFiles },
        { title: m.apiKeys, icon: IconKey, href: Routes.SettingsApiKeys },
        { title: m.notifications, icon: IconBell, href: Routes.SettingsNotifications },
      ],
    },
  ];
}

侧边栏配置类似于导航栏,但专门为仪表盘区域设计。它支持:

  • 带图标的顶级链接
  • 带嵌套可展开的菜单
  • 通过 authorizeOnly 属性实现菜单只有特定角色可见

侧边栏非常适合根据用户角色提供不同的菜单,例如普通用户只能看到仪表盘,管理员可以看到用户管理页面等。

Sidebar

下一步

现在您了解了侧边栏配置,请探索其他相关主题:

网站配置

配置网站的核心设置

导航栏配置

配置头部导航菜单

页脚配置

配置网站页脚中的链接

头像配置

配置用户头像下拉菜单

页脚菜单

配置网站页脚中的链接

头像按钮

配置用户头像下拉菜单

目录

下一步