Why we can't use async with the data function but it is ok with other functions? For example:
export default {
data: async function () { // not ok
return {
item: null,
}
},
beforeMount: async function() { // this is ok
let result = await axios.get('./data-social.json')
this.item = result.data
},
mounted() {
},
}
I will get this error:
[Vue warn]: data functions should return an object:
Any ideas?