wx.request()返回的是个promise对象吧,为什么then方法不支持
来源:11-8 从服务器加载数据分页数据并传入自定义组件
慕码人4339946
2021-08-09
onLoad: function (options) {
wx.request({
url: 'http://t.talelin.com/v2/movie/in_theaters?start=0&count=3'
}).then((res)=>{
console.log(res);
})
},
报错
VM3171 WAService.js:2 TypeError: wx.request(...).then is not a function
at qi.onLoad (movies.js? [sm]:24)
at qi.<anonymous> (WAService.js?t=wechat&s=1628469214546&v=2.18.0:1)
at qi.r.__callPageLifeTime__ (WAService.js?t=wechat&s=1628469214546&v=2.18.0:1)
at Cn (WAService.js?t=wechat&s=1628469214546&v=2.18.0:1)
at WAService.js?t=wechat&s=1628469214546&v=2.18.0:1
at An (WAService.js?t=wechat&s=1628469214546&v=2.18.0:1)
at Function.<anonymous> (WAService.js?t=wechat&s=1628469214546&v=2.18.0:1)
at u.<anonymous> (WAService.js?t=wechat&s=1628469214546&v=2.18.0:1)
at u.emit (WAService.js?t=wechat&s=1628469214546&v=2.18.0:1)
at Object.emit (WAService.js?t=wechat&s=1628469214546&v=2.18.0:1)(env: Windows,mp,1.05.2107090; lib: 2.18.0)
errorReport @ VM3171 WAService.js:2
thirdErrorReport @ VM3171 WAService.js:2
(anonymous) @ VM3171 WAService.js:2
(anonymous) @ VM3171 WAService.js:2
r.__callPageLifeTime__ @ VM3171 WAService.js:2
Cn @ VM3171 WAService.js:2
(anonymous) @ VM3171 WAService.js:2
An @ VM3171 WAService.js:2
(anonymous) @ VM3171 WAService.js:2
(anonymous) @ VM3171 WAService.js:2
u.emit @ VM3171 WAService.js:2
emit @ VM3171 WAService.js:2
(anonymous) @ VM3171 WAService.js:2
u.emit @ VM3171 WAService.js:2
emit @ VM3171 WAService.js:2
(anonymous) @ VM3171 WAService.js:2
(anonymous) @ VM3171 WAService.js:2
c @ VM8 asdebug.js:1
u @ VM8 asdebug.js:1
(anonymous) @ VM8 asdebug.js:1
f @ VM8 asdebug.js:1
g @ VM8 asdebug.js:1
(anonymous) @ VM8 asdebug.js:1
_ws.onmessage @ VM8 asdebug.js:1
1回答
-
7七月
2021-08-14
wx.request 是不支持promise的
00
相似问题