[Vuejs]-How computed variable get updated in Vue.js

0๐Ÿ‘

1- Using arrow functions there is no need to put the this keyword to another variable.

2- Please read this article how event bus works

In the component which the request is made:

send_request () {
  axios.put('url_here', { data_here })
    .then(response => eventbus.$emit('data_updated', response.data))
}

In the component you want to listen on that event:

created() {
 eventBus.$on('data_updated', data => {
   console.log(data);
 })
}

In this example i used axios,which i recommend to use.Take a look

Leave a comment