In one of my components, I have a property called kpi_kalite[] in the child component.
Within the parent component's mounted() method:
(The kpi_kalite array is defined in the data property of the parent component)
axios.get(URL+ "/KPI/").then(response=>{
console.log(JSON.parse(JSON.stringify(response.data)))
this.kpi_kalite.push(response.data[0])
})
I make a 'get request' in the parent component and add the response data to the kpi_kalite[] array (in the parent component).
Then, I pass this array as props to the child component.
However, when I try to log this.kpi_kalite in beforeMount or Mounted, it shows undefined.
methods : {
set_input(){
console.log(this.kpi_kalite)
for(const i in this.kpi_kalite){
console.log(i)
console.log(JSON.parse(JSON.stringify(this.kpi_kalite))) // output
// "undefined"
}
}
},
beforeMount() {
this.set_input()
}
The console output shows: undefined
Can anyone assist me? I need to access the parent component's data in the child component before the HTML-CSS is loaded.