Hi,
I have nested routes.
In the container I'm doing some actions to fetch api, write in store, create computed objects, etc..
I need them in the container, but I also need them in the children pages.
It would be really cool to be able to pass props to children pages to avoid to re-do all this operations on all the nested pages.
Thanks!
// container
<div>
<UserInfos :user="user">
<Tabs>
<nuxt-child :user="user"/>
</div>
// nested
props: {
user : {}
},
If we could have nested layouts, it could solve your issue I suppose?
@lucpotage hem... Sorry I don't see the link with nested layout. 馃槙
@mathieutu OK, I thought that layout data was automatically passed to the pages depending on it but it's not the case.
It seems the store is the only solution to your problem: https://github.com/nuxt/nuxt.js/issues/1894
This feature-request has been implemented by @Atinux, @clarkdo.
This works in latest
nuxt-edge
pages/child.vue:
<template>
<nuxt-child :test="'RESOLVE_PLZ'"/>
</template>
pages/child/index.vue:
<template><h1> DO IT! </h1> </template>
<script>
export default {
props: ["test"],
mounted(){
console.log(this.test) //RESOLVE_PLZ
}
}
</script>
Thank you guys!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
This feature-request has been implemented by @Atinux, @clarkdo.
pages/child.vue:pages/child/index.vue: