Home

Issue: 647

How to pass data to layout from index.vue?

[issue link]

i have in layout/main.vue:

...
<navbar :somedata="somedata"/>
<nuxt/>
...
import navbar from '~components/navbar.vue';
...

I want to send to navbar data from the index.vue:

data() {
    return: {
        somedata: 'sometext'
    }
}

and in components/navbar.vue:

props: ['somedata']

but i get: [Vue warn]: Property or method "somedata" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.
How to do?

This question is available on Nuxt.js community (#c564)