I am new to Vue and facing an issue with accessibility. I have two files.
The first file is App.vue where <router-view>
is defined:
<script>
export default {
name: 'app',
data(){
return{
info: false,
}
},
beforeMount(){
example...
this.info= true
this.$router.push('/main'); //where in router-view visible is component Main.vue
}
}
</script>
The second file is the Main.vue component which is as follows:
<script>
export default{
name: 'main',
data(){
return{
}
},
beforeMount(){
//what i want to do:
console.log(App.data().info) //here should be visible true in console log
}
}
I want to access the property from the first file in the second file. How can I achieve this correctly? Thank you in advance.