Can you help me figure out this issue?
Snippet :
<a href="#" class="video" @click.prevent="checkVideo(subItem.id)" :id="subItem.id" data-toggle="modal" data-target="#playerModal">{{subItem.name}}<span>{{getDuration(subItem.id)}}</span></a>
VueJS Function :
async getDuration(id) {
var duration = '';
await axios.post('/api/v1/checkvideo', {
menu: id
})
.then(function (response) {
console.log(response.data[0].datas.duration)
return response.data[0].datas.duration;
});
//console.log(duration);
//return duration;
},
The question I have is that when using console.log
the values appear as expected, but during Vue rendering, I am getting [object Promise]
. How can I display the values after the promise has been resolved?
Your assistance would be greatly appreciated.