You are awaiting this.fetchData()
, but that is not returning a promise.
You want to add await this.$store.dispatch('getData')
. You are also not making use of the lang
param.
In other words, I guess the following would work...
async fetch() {
await this.fetchData();
await this.fetchData2();
},
methods: {
async fetchData() {
await this.$store.dispatch('getData')
},
async fetchData2() {
let res = await api.getData2();
},
}
(or even just returning this.$store.dispatch('getData')
without fetchData
being an async fn)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…