//index.js
getData01: function () {
return new Promise(() => {
db.collection("question").where({
_openid: '{openid}'
}).get().then((res) => {
console.log('a')
}).catch((err)=>{
console.log(err)
})
})
},
getData02: function () {
return new Promise(() => {
db.collection("question").where({
_openid: '{openid}'
}).get().then((res) => {
console.log('b')
}).catch((err)=>{
console.log(err)
})
})
},
getData03: function () {
return new Promise(() => {
db.collection("question").where({
_openid: '{openid}'
}).get().then((res) => {
console.log('c')
}).catch((err)=>{
console.log(err)
})
})
},
onLoad: function () {
Promise.all([this.getData01(), this.getData02(), this.getData03()])
.then(function() {
console.log('成功')
}).catch((err)=>{
console.log(err)
})
},
结果只要a,b,c。如图 ↓

getData01、getData02、getData03 你都没有resolve或者reject结果,当你三个promise都resolve或者reject了,就会执行then或者catch Ps: 三个都resolve => 执行then,三个有一个reject → 执行catchgetData01: function () {return new Promise((resolve) => {db.collection("question").where({_openid: '{openid}'}).get().then((res) => {resolve()console.log(res)}).catch((err)=>{console.log(err)})})},Promise.all([ db.collection().get(), db.collection().get(), db.collection().get(), ]).then()Promise.all(arr).then(res => {console.log("resall=", res);// 循环把图片放进excelfor (let resIndex in res) {let imageData = res[resIndex];console.log("imageData=",imageData);ws.addImage({// 这个也不会执行image: imageData.fileContent,type: 'picture',position: {type: 'twoCellAnchor',from: {col: imageData.fromCol,colOff: 0,row: imageData.fromRow,rowOff: 0,},to: {col: imageData.toCol,colOff: 0,row: imageData.toRow,rowOff: 0,},},});console.log("里面执行完了")}ws.cell(2, 7).string("imageData.toCol3").style(style);// 这一行不会执行console.log("外面执行完了")}).catch(err => {console.log("导出报错了", err);});请问下为什么上面两行标记的不执行呢