0👍
Reading your comments with @Satyam, maybe a watcher could help?
watch: {
order() {
if(this.order && this.order.BillNo)
this.doSomethingWith(this.order.BillNo) // callback
}
}
0👍
The solution depends on what you want to do with the data. The primary "problem" is that you are working here with asynchronous call.
mounted() {
Fire.$on('orderId', (id) => {
axios.get('/api/order/'+id).then(({data}) => {
this.order = data.order;
this.orders_details = data.order_details;
console.log(this.order.BillNo) // fires after the request
});
});
console.log(this.order.BillNo) // fires immediately bevor request
},
In most cases the following will be the solution:
<div v-if="order">...</div>
<my-loader v-else/>
- [Vuejs]-MEVN app deployment to Heroku failed because of 'vue-cli-service' not found
- [Vuejs]-Full-Calendar Vue refetch-events error? nothing appears to happen
Source:stackexchange.com