0👍
Ah, you are returning an object. But not an array of objects. So you have to pass in
Object_values()
in the api call. So something like this:
async fetchWorkerTimeCard() {
if (this.calendarVal == null) {
// get today
} else {
try {
await this.$axios.$get('/worker_time_card', { params: { work_date: this.calendarVal } }).then(Object_values(data) => {
this.worker_time_card.push( {
start_time: data.start_time,
end_time: data.end_time,
rest_time: data.rest_time,
worked_time: data.worked_time,
duration: data.time_cards[0].duration,
work_log: data.time_cards[0].work_log,
project_id: data.time_cards[0].project_id,
})
})
} catch (error) {
console.log(error)
this.worker_time_card = []
}
}
},
- [Vuejs]-How to check if the email exist in vue.js user registration?
- [Vuejs]-HTML 5 wait for drawImage to finish in a Vue SPA
Source:stackexchange.com