Skip to content

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

@cypherchen

Description

@cypherchen

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

  • Read the docs
    Ensure the code is up to date. (Some issues have been fixed in the latest version)
    I have searched the existing issues and checked that my issue does not duplicate any existing issues.
    Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
    The provided reproduction is a minimal reproducible example of the bug.

Activity

miaowwwww

miaowwwww commented on Jan 21, 2025

@miaowwwww

哥, 最后有处理方案吗?

cypherchen

cypherchen commented on Jan 21, 2025

@cypherchen
Author

哥, 最后有处理方案吗?

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

miaowwwww

miaowwwww commented on Jan 22, 2025

@miaowwwww

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

cypherchen

cypherchen commented on Feb 5, 2025

@cypherchen
Author

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

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

dingdayu

dingdayu commented on Feb 8, 2025

@dingdayu
Contributor

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

#5500

github-actions

github-actions commented on Apr 10, 2025

@github-actions

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

locked and limited conversation to collaborators on May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @dingdayu@miaowwwww@cypherchen

      Issue actions

        Bug: 关于动态路由的params和query的问题 · Issue #5434 · vbenjs/vue-vben-admin