我有<vue-element-loading :active="isActive" :is-full-screen="true"/>
包,并将其组件添加到了我的页面中。vue:
data () {
return {
isActive: false,
}
}
为数据添加了变量:
isActive
然后在页面加载完成后触发true
到async created () {
this.isActive = true
await this.fetchData()
this.isActive = false
}
:
fetchData
fetchData
是带有响应的axios get请求。想法是展示装载机,直到axios正确点火并获得响应。但是现在,我的加载程序显示了0.1毫秒,然后消失了。
这是fetchData () {
axios.get(globalConfig.OFFERS_URL)
.then((resp) => {
this.offersData = resp.data
console.log(resp)
})
.catch((err) => {
console.log(err)
})
},
方法:
=iferror(vlookup((B2+1)&C2,$A$2:$D$9,4,false),"error")
答案 0 :(得分:1)
您的fetchData()
似乎没有从对Promise
的调用中返回axios.get()
,因此await
的调用会立即解决(即,在{{ 1}}完成。
解决方法是返回axios.get()
的结果:
axios.get()