[Vuejs]-Vue Router not matching a url with multiple dynamic values

3👍

The problem is that you try to use the minus sign as the parameter name:

/nutrients/:slug/:nutrient-slug

But the regular expression from the path-to-regexp package for parsing the path-pattern uses the \w character classe as the name-pattern:

\w+ matches any word character (equal to [a-zA-Z0-9_])

So use underscore instead of minus:

/nutrients/:slug/:nutrient_slug

[ https://jsfiddle.net/fhrekL25/ ]

Leave a comment