Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 当路径大于一层时,sidebar只会显示当前路径下目录 #1960

Closed
faner11 opened this issue Nov 3, 2023 · 3 comments
Closed
Labels
question Further information is requested

Comments

@faner11
Copy link

faner11 commented Nov 3, 2023

Version

2.2.13

OS Version

14.0

Node.js Version

20.9.0

Browser Version

118

Link to minimal reproduction

Steps to reproduce

当我的路径为http://localhost:8000/zh-CN/guide 正常工作
image
当我的路径为http://localhost:8000/zh-CN/guide/advanced/validate,只展示了advanced下的导航
image

以下是我的配置

  themeConfig: {
    sidebar: {
      '/zh-CN/guide': [
        {
          title: '指南',
          children: [
            {
              title: '介绍',
              link: '/zh-CN/guide',
            },
            {
              title: '如何学习Formily',
              link: '/zh-CN/guide/learn-formily',
            },
            {
              title: '快速开始',
              link: '/zh-CN/guide/quick-start',
            },
            {
              title: 'V2升级指南',
              link: '/zh-CN/guide/upgrade',
            },
            {
              title: '贡献指南',
              link: '/zh-CN/guide/contribution',
            },
            {
              title: '表单设计器开发指南',
              link: '/zh-CN/guide/form-builder',
            },
            {
              title: '问题反馈',
              link: '/zh-CN/guide/issue-helper',
            },
          ]
        },
        {
          title: '场景案例',
          // link: '/zh-CN/guide/',
          children: [
            {
              title: '登录注册',
              link: '/zh-CN/guide/scenes/login-register',
            },
            {
              title: '查询列表',
              link: '/zh-CN/guide/scenes/query-list',
            },
            {
              title: '编辑详情',
              link: '/zh-CN/guide/scenes/edit-detail',
            },
            {
              title: '弹窗与抽屉',
              link: '/zh-CN/guide/scenes/dialog-drawer',
            },
            {
              title: '分步表单',
              link: '/zh-CN/guide/scenes/step-form',
            },
            {
              title: '选项卡/手风琴表单',
              link: '/zh-CN/guide/scenes/tab-form',
            },
            {
              title: '更多场景',
              link: '/zh-CN/guide/scenes/more',
            },
          ],
        },
        {
          title: '进阶指南',
          // link: '/zh-CN/guide/advanced/validate',
          children: [
            {
              title: '实现表单校验',
              link: '/zh-CN/guide/advanced/validate',
            },
            {
              title: '实现表单布局',
              link: '/zh-CN/guide/advanced/layout',
            },
            {
              title: '实现异步数据源',
              link: '/zh-CN/guide/advanced/async',
            },
            {
              title: '实现表单受控',
              link: '/zh-CN/guide/advanced/controlled',
            },
            {
              title: '实现联动逻辑',
              link: '/zh-CN/guide/advanced/linkages',
            },
            {
              title: '实现联动计算器',
              link: '/zh-CN/guide/advanced/calculator',
            },
            {
              title: '实现自定义组件',
              link: '/zh-CN/guide/advanced/custom',
            },
            {
              title: '前后端数据差异兼容方案',
              link: '/zh-CN/guide/advanced/destructor',
            },
            {
              title: '管理业务逻辑',
              link: '/zh-CN/guide/advanced/business-logic',
            },
            {
              title: '按需打包',
              link: '/zh-CN/guide/advanced/build',
            },
          ],
        },
      ]
    },
  },

What is expected?

像V1 版本一样工作
https://formilyjs.org/zh-CN/guide/advanced/validate

What is actually happening?

Any additional comments? (optional)

No response

@PeachScript
Copy link
Member

PeachScript commented Nov 9, 2023

这在 v2 中是期望结果,因为支持约定式二级导航,所以一级路由和二级路由默认会有不同的侧边菜单,如果要用配置式替代的话,需要把二级路径也配上,例如:

{
  '/zh-CN/guide': [...],
  '/zh-CN/guide/advanced': [...]
}

@PeachScript PeachScript added question Further information is requested and removed unconfirmed labels Nov 9, 2023
@FanSun521
Copy link

  '/examples': [
    {
      title: '示例',
      children: [
        {
          title: '节点',
          link: '/examples/node',
        },
        {
          title: '边',
          link: '/examples/edge',
        },
        {
          title: '自定义react节点',
          link: '/examples/react',
        },
        {
          title: '插件',
          link: '/examples/extension',
        },
        {
          title: '场景案例',
          link: '/examples/case',
          // children: [
          //   {
          //     title: '业务场景',
          //     link: '/examples/case/businessScene'
          //   },
          //   {
          //     title: '示例',
          //     link: '/examples/case/demo'
          //   }
          // ]
        },
      ],
    },
  ],
  '/examples/case': [
    {
      title: '场景案例',
      children: [
        {
          title: '业务场景',
          link: '/examples/case/businessScene',
        },
        {
          title: '示例',
          link: '/examples/case/demo',
        },
      ],
    },
  ], 二级路由配上侧边栏还是不显示

@FanSun521
Copy link

我是在pages页面下写的tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants