admin管理员组文章数量:1023866
hello guys i'm new to vue js and i'm trying to pass paramenters to a specific router this should happen when i click on a card research and then it will redirect to the research details ponent called actions-log but when i call this router via
this.$router.push({ name: "actions-log", params: { Id: "3" } })
it gives me an error in the console says:
Uncaught (in promise) Error: No match for {"name":"3","params":{}}
so can any one help me with that error please......
hello guys i'm new to vue js and i'm trying to pass paramenters to a specific router this should happen when i click on a card research and then it will redirect to the research details ponent called actions-log but when i call this router via
this.$router.push({ name: "actions-log", params: { Id: "3" } })
it gives me an error in the console says:
Uncaught (in promise) Error: No match for {"name":"3","params":{}}
so can any one help me with that error please......
Share Improve this question edited Feb 3, 2022 at 18:40 tony19 139k23 gold badges278 silver badges348 bronze badges asked Feb 3, 2022 at 10:07 nerweennerween 411 silver badge8 bronze badges 2- That is how I do it, too. Weird is, that he thinks that "3" is the name. ... have not used params in capital. But I would not think, that it makes a difference. ... It could be the dash in actions-log. Sometime dashed names cause some errors in some places in Vue. – Ehrlich_Bachman Commented Feb 3, 2022 at 14:12
- @Ehrlich_Bachman no not working... – nerween Commented Feb 3, 2022 at 19:36
2 Answers
Reset to default 2You can use path
const routeId = 3
this.$router.push({ path: `/actions-log/${routeId}` })
i figured out what's happening i have a ponent called pageTitle this ponent is included by every other ponent i use it to make the breadcrumb using the:
this.$route.fullPath
then spliting it and looping the values with :
<li><router-link></router-link></li>
to make the breadcrumbs links but the fullPath prop of the vue router it returns the params too so through the loop in:
<router-link :to="{ name: {path} }">{{ path }}</router-link>
vue checks if the router is exists with the given name, for example when i put /actions-log/3 as params int the url it will be set in the :to attribute becuase of this behavios it's launch that exception;
so i think i solved the problems in the following puted fuction :
i don't know if someone has a better idea to create a breadCrumbs in vue... anyway thank you so much for helping me to resolve this problem.
hello guys i'm new to vue js and i'm trying to pass paramenters to a specific router this should happen when i click on a card research and then it will redirect to the research details ponent called actions-log but when i call this router via
this.$router.push({ name: "actions-log", params: { Id: "3" } })
it gives me an error in the console says:
Uncaught (in promise) Error: No match for {"name":"3","params":{}}
so can any one help me with that error please......
hello guys i'm new to vue js and i'm trying to pass paramenters to a specific router this should happen when i click on a card research and then it will redirect to the research details ponent called actions-log but when i call this router via
this.$router.push({ name: "actions-log", params: { Id: "3" } })
it gives me an error in the console says:
Uncaught (in promise) Error: No match for {"name":"3","params":{}}
so can any one help me with that error please......
Share Improve this question edited Feb 3, 2022 at 18:40 tony19 139k23 gold badges278 silver badges348 bronze badges asked Feb 3, 2022 at 10:07 nerweennerween 411 silver badge8 bronze badges 2- That is how I do it, too. Weird is, that he thinks that "3" is the name. ... have not used params in capital. But I would not think, that it makes a difference. ... It could be the dash in actions-log. Sometime dashed names cause some errors in some places in Vue. – Ehrlich_Bachman Commented Feb 3, 2022 at 14:12
- @Ehrlich_Bachman no not working... – nerween Commented Feb 3, 2022 at 19:36
2 Answers
Reset to default 2You can use path
const routeId = 3
this.$router.push({ path: `/actions-log/${routeId}` })
i figured out what's happening i have a ponent called pageTitle this ponent is included by every other ponent i use it to make the breadcrumb using the:
this.$route.fullPath
then spliting it and looping the values with :
<li><router-link></router-link></li>
to make the breadcrumbs links but the fullPath prop of the vue router it returns the params too so through the loop in:
<router-link :to="{ name: {path} }">{{ path }}</router-link>
vue checks if the router is exists with the given name, for example when i put /actions-log/3 as params int the url it will be set in the :to attribute becuase of this behavios it's launch that exception;
so i think i solved the problems in the following puted fuction :
i don't know if someone has a better idea to create a breadCrumbs in vue... anyway thank you so much for helping me to resolve this problem.
本文标签: javascripterror while using params in the routerpush function vuerouter 4Stack Overflow
版权声明:本文标题:javascript - error while using params in the router.push function vue-router 4 - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745561603a2156192.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论