I am creating a very simple website. I want to change the Navbar elements depending on data set in navLayout on the page template. I want to pass the data to the layout, then use props to send it to the NavBar. My issue is how to emit data from the page to the layout.
layouts/default.vue
<template>
<div>
<NavBar />
<div class="site-container">
<nuxt />
</div>
<Footer />
</div>
</template>
<script>
import NavBar from '~/components/NavBar.vue'
export default {
components: {
NavBar,
}
}
</script>
pages/index.vue
...
<script>
export default {
data: () => {
return {
navLayout: 'simple'
}
},
computed: () => {
return {
this.$emit('navLayout', value)
}
}
...
</script>