141
rated 0 times
[
143]
[
2]
/ answers: 1 / hits: 18882
/ 4 Years ago, thu, june 25, 2020, 12:00:00
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>
More From » vue.js