[Vuejs]-Passing variable from controller to vue?

0👍

There are few issues. A <td> tag wont fire a change event.

Even if you set it up to listen for an update you would run into an infinite loop issue.

You also need a way to store different progress values.

You could update the projets object like this:

avancemant(id){
  axios.get('/api/progress/'+id).then(
     ({data}) => (this.projets.data[id].progress = data.data)
  )
}

And call it from the mounted hook like this:

mounted () {
    Object.values(this.projets.data).forEach(function(x){
       this.avancemant(x.id)
    })
}

Of course, this will only fire once. Getting it to fire multiple times depending on the progress level is a different question.

Leave a comment