Hello,
I want to pass the property infoPage from Home / About to Navbar
In router → index.js we have included the components: Home.vue and About.vue
My components:
App.vue
<template>
<header>
<Navbar/>
</header>
<main>
<router-view/>
</main>
</template>
<script>
import Navbar from "....";
export default {
components: {Navbar}
}
</script>
Navbar.vue
<template>
<div>
<h6> here I want to introduce the infoPage property from Home.vue or About.vue </h6>
</div>
</template>
<script>
export default {
name: "Navbar",
}
</script>
Home.vue
<template>
<div class="home">
text text
</div>
</template>
<script>
export default {
name: 'Home',
data() {
return {
infoPage: 'Name page Home'
}
}
}
</script>
About.vue
<template>
<div class="about">
text text
</div>
</template>
<script>
export default {
name: 'About',
data() {
return {
infoPage: 'Name page About'
}
}
}
</script>
Use: Vue.js 3, Vuex and folder structure created with Vue CLI