Optional param casted automatically on routerLink even if we don't want optional param (when param is already set in url) #2247
Unanswered
JulienMalcouronne
asked this question in
Help and Questions
Replies: 1 comment 8 replies
-
I attempted to reproduce the problem you're seeing based on the examples you gave, but it seemed to be working fine for me: I didn't really understand what you meant about <RouterLink :to="{ ...$route, params: {} }"> |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello I'm not sure this is a bug or perhaps there are wrong stuff in our codebase.
Once we set a param to be optional in the routes definition, the
RouterLink :to={...route.name}
without parameters in the code then the param is automatically set if we currently are on this route.Is there a way to prevent that to happening?
Example:
for instance if I'm on the following route
{name: dashboard, params: {id: 1}}
I have the following links ->
{name: dashboard}
-> the first<a href="dashboard/1">
where it should be only /dashboard{name: dashboard, params: {id: 2}}
We are using:
"vue-router": "^4.3.2",
"vue": "3.4.27",
Beta Was this translation helpful? Give feedback.
All reactions