收藏
回答

【未解决 】开发中 wx.request 未执行

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows 1.02.1808080

- 当前 Bug 的表现(可附上截图)

wx.request 为能发起请求 但是放在index.js 文件中则能正常的发起HTTP 请求

如下图 网络中未发出 HTTP 请求



- 预期表现


- 复现路径


- 提供一个最简复现 Demo

使用微信小程序工具 选择 微信小程序模板创建  后新建视图 和相关脚本

在js  onLoad 中加入如下代码


var that = this;

wx.request({
  url: 'https://douban.uieee.com/v2/movie/top250',
  //'https://api.douban.com/v2/movie/top250',
  method: "GET",
  header: {
    'Content-Type': 'application/xml' //'application/json'
  },
  success: function (res) {
    console.log(res.data.subjects);
  },
  fail: function () {
    console.log("douban API ERROR!!!");
  }

});





回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容