Page({
onLoad() {
this.a()
},
async a() {
try {
await this.b()
await this.c()
await this.d()
} catch (error) {
wx.showToast({
title: error.err,
icon: 'none'
})
}
},
async b() {
return new Promise((resolve, rejcet) => {
wx.showModal({
title: "B?",
cancelText: "失败",
confirmText: "成功",
success: (res) => {
if (res.confirm) resolve();
else rejcet({ err: '点击了失败' })
},
fail: (err) => {
rejcet({ err: err.errMsg })
}
})
})
},
async c() {
return new Promise((resolve, rejcet) => {
wx.showModal({
title: "C?",
cancelText: "失败",
confirmText: "成功",
success: (res) => {
if (res.confirm) resolve();
else rejcet({ err: '点击了失败' })
},
fail: (err) => {
rejcet({ err: err.errMsg })
}
})
})
},
async d() {
return new Promise((resolve, rejcet) => {
wx.showModal({
title: "D?",
cancelText: "失败",
confirmText: "成功",
success: (res) => {
if (res.confirm) resolve();
else rejcet({ err: '点击了失败' })
},
fail: (err) => {
rejcet({ err: err.errMsg })
}
})
})
}
})