0👍
mounted
, as the name suggests, is only called during component creation (the Vue.js API docs say “Called after the instance has just been mounted where el is replaced by the newly created vm.$el”). Since you wish to display the data after sending it to database, then your function call should be executed right after your firebase code is done.
methods:{
sendData(){
this.$http.post('FIREBASE-LINK/data.json', this.user).then(response=>{
console.log(response)
this.getData()
}).catch(err=>{
console.log(err)
})
},
getData: function () {
this.$http.get('FIREBASE-LINK/data.json').then(resp=>{
this.users = resp.body
}).catch(err=>{
console.log(err)
})
}
}
Source:stackexchange.com