es6 Promise.all 用法

init() {

this.pageLoading = true;

Promise.all([this.getTime(), this.getAddress()])

.then(([time, host]) => {

this.loading= false;

this.form.time= time;

this.form.host = host;

})

.catch(() => {

this.loding= false;

});

},

getTime() {

return this.$post("/query");

},

// 查询上次时间同步的地址

getAddress() {

return this.$post("/del");

},

mounted() {

this.init()

},

相关推荐
与妖为邻4 分钟前
HTML5动态时间显示组件
javascript·css·css3
Cache技术分享9 分钟前
247. Java 集合 - 为什么要远离 Stack 类?
前端·后端
●VON11 分钟前
Electron for HarmonyOS 开发环境搭建
javascript·electron·harmonyos
v***913019 分钟前
Spring+Quartz实现定时任务的配置方法
android·前端·后端
Irene199121 分钟前
JavaScript 常见类数组对象对比(附:具有默认迭代器的数据类型详解)
javascript·类数组对象
charlie11451419127 分钟前
面向C++程序员的JavaScript 语法实战学习4
开发语言·前端·javascript·学习·函数
万少28 分钟前
上架元服务-味寻纪 技术分享
前端·harmonyos
想不明白的过度思考者38 分钟前
Spring Web MVC从入门到实战
java·前端·spring·mvc
AAA简单玩转程序设计1 小时前
C++进阶小技巧:让代码从"能用"变"优雅"
前端·c++
子洋1 小时前
群晖 DSM 更新后 Cloudflare DDNS 失效的排查记录
前端·后端·dns