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

route 切换跳转 如果有 ice.config.mts 内配置的路由 切换菜单的时候会有问题 #6958

Open
HowCanLove opened this issue Jul 26, 2024 · 1 comment
Labels

Comments

@HowCanLove
Copy link

HowCanLove commented Jul 26, 2024

Describe the bug

/// 设置多个菜单,直至出现滚动条。 切换 关于我们1/关于我们2 时,menu会回到顶部,无法显示当前选中的菜单,
/// 按照正常情况,切换菜单不会菜单,菜单不会滚回到顶部的

const asideMenuConfig: MenuDataItem[] = [
{
name: '工作台',
path: '/',
},
{
name: '表单',
path: '/form',
},
{
name: '列表',
path: '/list',
},
{
name: '结果&异常',
children: [
{
name: '成功',
path: '/success',
},
{
name: '404',
path: '/404',
},
{
name: '成功',
path: '/success',
},
{
name: '404',
path: '/404',
},
{
name: '成功',
path: '/success',
},
{
name: '404',
path: '/404',
},
{
name: '成功',
path: '/success',
},
{
name: '404',
path: '/404',
},
{
name: '成功',
path: '/success',
},
{
name: '404',
path: '/404',
},
{
name: '成功',
path: '/success',
},
{
name: '404',
path: '/404',
},
{
name: '成功',
path: '/success',
},
{
name: '404',
path: '/404',
},
],
},
{
name: '关于',
children: [
{
name: '关于我们1',
// 这里是使用 ice.config.mts 中 routes 配置的,
// routes: {
// defineRoutes: (route) => {
// route('/', 'layout.tsx', () => {
// route('/about-me', 'custom-about-me/index.tsx');
// });
// },
// },
path: '/about-me',
},
{
name: '关于我们2',
path: '/about',
},
],
},
];

Expected behavior

2024-07-26.14.12.05.mov

如果使用文件夹生成的路由 切换的时候就没问题,但项目中需要这样子使用

{
name: '关于我们',
children: [
{
name: '关于我们',
path: '/custom-about-me',
},
{
name: '关于我们',
path: '/about',
},
],
},

Actual behavior

No response

Version of ice.js

3.4.0

Content of build.json or ice.config.mts

No response

Additional context

No response

@HowCanLove HowCanLove added the bug label Jul 26, 2024
@HowCanLove HowCanLove changed the title 菜单列表中的path使用 有 ice.config.mts route('/about-you', 'about.tsx'); route 切换跳转 如果有 ice.config.mts 内配置的路由 切换菜单的时候会有问题 Jul 26, 2024
@ClarkXia
Copy link
Collaborator

可以对比下 .ice 目前下 routes.ts 的结构,通过 defineRoutes 默认是追加路由,存在先后匹配规则影响

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

No branches or pull requests

2 participants