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()

},

相关推荐
CDN3602 分钟前
【前端进阶】告别“慢”与“不安全”:我是如何用360CDN搞定API加速和HTTPS的
前端·安全·https
Rabbit码工3 分钟前
HTML5 与 CSS3 新特性全解析:从结构优化到视觉升级
前端·css·css3·html5
王美丽1.853 分钟前
css3选择器
前端·css·css3
噜噜薯3 分钟前
HTML5和CSS3的核心新增特性及其语法
前端·css3·html5
.Cnn7 分钟前
Ajax与Vue 生命周期核心笔记
前端·javascript·vue.js·笔记·ajax
王铁柱6669 分钟前
使用css3如何对动画进行延时操作?
前端·css·css3
海风总是软软的9 分钟前
CSS3伪类选择器详解
前端·css3
心易行者13 分钟前
代码写好了,然后呢?——手把手教你把Python脚本变成能赚钱的Web应用
开发语言·前端·python
程序员蓝莓14 分钟前
别再花钱买HTTPS证书了!永久免费自动更新证书-Let's Encrypt。三步无脑安装。
前端
LinHan15 分钟前
功能区代码块一直不能优雅折叠?2026年,我终于用这个 VS Code 插件解决了
前端