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: 关于动态路由的params和query的问题 #5434

Open
5 tasks done
cypherchen opened this issue Jan 18, 2025 · 5 comments · May be fixed by #5500
Open
5 tasks done

Bug: 关于动态路由的params和query的问题 #5434

cypherchen opened this issue Jan 18, 2025 · 5 comments · May be fixed by #5500

Comments

@cypherchen
Copy link

Version

Vben Admin V5

Describe the bug?

这个是我的路由定义, bId是可选值

Image

这个是bId为空时, 路由把params的:bid部分当做静态值, 正常来说应是 /listPreparation

Image

这个是在menu里打印的一些值

Image

Image

希望可以用路由的name来判断当前菜单和标签页的高亮和生成, 用fullPath和path的话, 同一个路由的params和query的值变化时, 都会生成新的标签页, 或者是高亮状态和页面刷新的异常

Reproduction

定义和我一样的路由, 页面用两个按钮调用下面函数就可以复现

push({
    name: currentRoute.value.name,
    params: {
      bId: currentNode.value!.ID,  // 两次id不同即可
    },
  });

### System Info

```shell
/

Relevant log output

Validations

@miaowwwww
Copy link

哥, 最后有处理方案吗?

@cypherchen
Copy link
Author

哥, 最后有处理方案吗?

我想到的就是用路由的name来当做菜单和标签页的key值, 不过我看了源码里基本都是用fullPath或者path, 这么改的话改动很大, 暂时没有去尝试, 不知道有没有别的好的方法

@miaowwwww
Copy link

miaowwwww commented Jan 22, 2025

Image
我找到方法了。
加上这两个参数, 然后 dynamicLevel:1 。
这样可以保证不会新增tab

@cypherchen
Copy link
Author

Image 我找到方法了。 加上这两个参数, 然后 dynamicLevel:1 。 这样可以保证不会新增tab

我试了下, 这两个参数好像没啥用啊

@dingdayu
Copy link
Contributor

dingdayu commented Feb 8, 2025

@miaowwwww @cypherchen 我在解决其他问题时,也遇到这个问题,我提交了一个PR,一起讨论下。

#5500

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

Successfully merging a pull request may close this issue.

3 participants