1
I’m trying to update a method of a child Component, but so far I have no solution, my question is the following.
Within the Header.vue, I show the hours outstanding
<span>
<b>{{Hours}}</b> horas pendentes
</span>
hours(){
axios.get(`http://localhost:83/Pendencia/HorasPendentes/${this.$localStorage.get('RecursoId')}`)
.then(res => {
this.Hours = res.data.Retorno
})
.catch(err => console.log(err))
}
Now in my file Pendencia.vue, I think a API, and on the return of that API call on the Pendencia.vue would like to call again the API of Header.vue.
I can use it even in my question (which maybe I haven’t explained it right). I use
Nested Routes, there thePendenciasis part of theDashboard, and theHeader, is being called in theDashboardand not in thePendencia, sorry I haven’t explained this before.– Rafael Augusto
Can’t find the Header component from Pendencias is this?
– Felipe Duarte
Yes, I used your code, giving a
console.log(this.$children.find(component => component.$options.name === "Header"))and returned meundefined– Rafael Augusto
understood, so the two components are children of
Dashboard. In case you can go back to the parent and look for the child component:this.$parent.$children.find(component => component.$options.name === "Header")– Rubens Barbosa
It worked, thanks
– Rafael Augusto
@Rubensbarbosa Following the same logic, how would I do the same, however to call a function that is within my child Component? <Datepicker /> ?
– Rafael Augusto