2***@qq.com
2***@qq.com
  • 发布:2019-11-18 10:38
  • 更新:2019-11-18 10:38
  • 阅读:8302

uni.request 第一次请求 输出Uncaught (in promise) TypeError: undefined is not iterable!

分类:HBuilderX

uni-app项目,运行H5到chrome,首页的uni.request 请求数据,控制台会输出错误信息
Uncaught (in promise) TypeError: undefined is not iterable! core.get-iterator.js:5
at ./node_modules/core-js/library/modules/core.get-iterator.js.module.exports.__webpack_require__.getIterator (core.get-iterator.js:5)
at Subscribe._callee$ (pages-index-index~pages-index2level-index2level.js:4852)
at tryCatch (runtime.js:62)
at Generator.invoke [as _invoke] (runtime.js:288)
at Generator.prototype.<computed> [as next] (runtime.js:114)
at asyncGeneratorStep (asyncToGenerator.js:5)
at _next (asyncToGenerator.js:27)
at asyncToGenerator.js:34
at new Promise (<anonymous>)
at new F (_export.js:36)

uni.request是按照例子写的,且值有主页这个请求会报错,跳转到子页面后,在页面及其它请求并没有报错。

uni.request({
url: 'http://api.shangpibao.com/shangpibao/v2/advertise',
success: (res) => {
uni.hideLoading();
console.log(res.data)
},
fail: (res) => {
uni.showToast({title: '数据请求失败,请稍后再试!',icon:'none',uration: 2000});
},
complete: (res) => {}
});

2019-11-18 10:38 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复