test: function () {
let param = {
Channel: "H5",
ProductId: this.productId,
Version: 70100
};
console.log(2);
let url = "xxxxx";
return new Promise((resolve, reject) => {
cwx.request({
url: url,
data: param,
header: {
‘content-type‘: ‘application/json‘
},
method: ‘POST‘,
success: function (res) {
console.log(3);
resolve(res);
},
fail: function (ex) {
reject(ex);
}
})
});
},
onShow: function(){
console.log(1);
this.test()
.then((res)=>{
console.log(4);
})
.catch((ex)=>{
//异常处理
})
},
原文地址:https://www.cnblogs.com/-jianjian/p/11345825.html
时间: 2024-11-02 09:46:23