question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pages route params error

See original GitHub issue

Environment

nuxt: rc-12 node: v16.18.0 pnpm: 7.14.0 apple m1 max macos: 13.0

Reproduction

https://stackblitz.com/edit/github-pespjr?file=pages%2Fprice_[nid]_[sid].vue,pages%2Findex.vue

Describe the bug

route params error

Additional context

in my mind price_[nid]_[sid].vue /price_123_456 get {nid: 123, sid: 456}

Logs

get { "nid_": "1", "sid": "23_456" }

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
manniLcommented, Nov 2, 2022

Even if not ideal for SEO, using underscores should not affect params though.

Update: this is, if all, a vue-router issue though. See this example that shows the regex for _ vs. -. So please file an upstream issue there ☺️

For now, the workaround would be to use pages.extends and narrow down the parameters via regex if you want to keep using _. It would be easier to switch to - though.

0reactions
xjccccommented, Nov 2, 2022

Always use hyphens (-) and not underscores (_) because underscores cannot be seen when the URL is published as a bare link, … Somewhere on google

how u diff this [city-code].vue like /beijing/ or /shanghai/ [car-type].vue like /zixie/ or /zhongka/

routes middleware? or diff component?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Router URL Throws Error With Parameter
I am trying to use react router to have dynamic profile pages, preferably having it in slashes rather than like a ? parameter...
Read more >
Errors when parameters or arguments are missing for route
Sometimes, route parameters or arguments are not available for a specific route because they are dependent on the current page that is loaded...
Read more >
Error when refreshing pages using $route param - Vue Forum
The $route. param will disappear after refreshing pages. You could try $route. query to transfer your data.
Read more >
Error with Params on first load of page on Real Device
I want to use the path /groups/detail/xxx for a group with id = xxx, and I'm using links like that. So my route...
Read more >
Routing in Razor Pages
Routing is the system that matches URLs to Razor pages. Like most page-centric frameworks, the primary routing system in ASP.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found