vite-plugin-pages icon indicating copy to clipboard operation
vite-plugin-pages copied to clipboard

Pass props to the route?

Open ghost opened this issue 3 years ago • 2 comments

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

  • [X] Follow the Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

ghost avatar Nov 18 '22 09:11 ghost

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

blowsie avatar Nov 21 '22 18:11 blowsie

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.

abdul-alhasany avatar Nov 30 '22 13:11 abdul-alhasany