array(2) { ["docs"]=> array(0) { } ["count"]=> int(0) } 111string(0) "" int(1) int(10) int(70) int(8640000) string(13) "likecs_art_db" array(1) { ["query"]=> array(1) { ["match_all"]=> object(stdClass)#28 (0) { } } } array(1) { ["createtime.keyword"]=> array(1) { ["order"]=> string(4) "desc" } } int(10) int(0) int(8640000) array(2) { ["docs"]=> array(0) { } ["count"]=> int(0) } vue 中使用promise - 爱码网
init1(){
return new Promise((resolve, reject) => {
let data={
dateStr:this.time
};
api.get('url', null).then( res => {
//自己的操作
resolve()
}).catch(err => {
reject()
});
});
};
init2(){
return new Promise((resolve, reject) => {
let data={
dateStr:this.time
};
api.get('url', null).then( res => {
//自己的操作
resolve()
}).catch(err => {
reject()
});
});
};


//调用
Promise.all([this.init1(),this.init2()]).then(() => {
//两个都调成功以后执行的操作
//主要是loading问题
}).catch(err => {
// 抛出错误信息
});




相关文章: