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‘: ‘
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)=>{
//异常处理
})
},