//封装promise的一个方法
inspectionOrderList() {
var that = this
var p = new Promise(function (resolve, reject) {
http.inspectionOrderList({ //接口
.....
})
})
return p;
},
//在onload里面的调用
this.inspectionOrderList().then(res => {
console.log("----onload",res)
})
inspectionOrderList() { var that = this var p = new Promise(function (resolve, reject) { http.inspectionOrderList({ success: res=>{ //获取到了数据res.data; console.log(res); resolve(res.data); //这个有吗? }, fail: reject }) }) return p; } //在onload里面的调用 this.inspectionOrderList().then(res => { console.log("----onload",res) })
resolve/reject了吗?