hannoeru / vite-plugin-pages

File system based route generator for ⚡️Vite
MIT License
1.87k stars 128 forks source link

Pass props to the route? #335

Closed ghost closed 5 months ago

ghost commented 1 year ago

Description

Is there a way to pass props through router to the second page? Not params, not queries, but props?

https://router.vuejs.org/guide/essentials/passing-props.html#passing-props-to-route-components

Suggested solution

/

Alternative

No response

Additional context

No response

Validations

blowsie commented 1 year ago

I tried to implement a workaround but ran into a bug with extendRoute https://github.com/hannoeru/vite-plugin-pages/issues/338

abdul-alhasany commented 1 year ago

I wonder why you want to pass props and not params or anything else?

Either way, it seems that vue passes paramters as props but not documented very well. In the same link you sent you can see under Boolean mode that:

When props is set to true, the route.params will be set as the component props.

Which means you set props: true in the routes definition and then the params you pass to the route will be treated as props.