可以使用async/await来异步调用多个方法:

async mounted() { await this.getDetails(); await this.currency_list(); },

注意:被调用的方法需要返回一个Promise对象来确保异步调用的顺序。在这个例子中,getDetails和currency_list都使用了axios来发送异步请求,并返回了一个Promise对象。

vue mounted 中使用异步方式调用多个方法getDetails this$apiFungetDetailsthenres= let data = resdata ifresexpectRequestId && resexpectRequestId!=0sessionStoragesetItemrequestIdresexpectRequestId

原文地址: https://www.cveoy.top/t/topic/hN8p 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录