[Vuejs]-Route.params has properties that don't match dynamic url

0👍

It seems likely that the problem is here:

url: 'dashboard',

This would appear to be a relative path. So if you are currently on the page http://localhost:8080/article/edit-article/2 it will resolve relative to that URL, giving http://localhost:8080/article/edit-article/dashboard. This isn’t really anything to do with Vue router, it’s just how relative URLs are resolved. You’d get exactly the same behaviour if you used an HTML link such as <a href="dashboard">.

If you start your relative URL with a / then it will omit the rest of the path:

url: '/dashboard',

This should fix your problem. This is what you’ve done with your /page URL, which is presumably why that works.

Personally I would use named routes instead, rather than trying to craft relative URLs. See https://router.vuejs.org/guide/essentials/named-routes.html

Leave a comment