douban: function (){

wx.request({

url: 'https://douban.uieee.com/v2/book/1220562',

//必须要设置"content-type":"json",不然会报错 400 (Bad Request)

header:{

"content-type":"json"

},

success: function (backData){

console.log(backData);

}

})

}

在请求数据时,如果遇到以下问题

微信小程序使用豆瓣API接口

这是因为在小程序中发起了wx.request请求,但是请求的域名没有在微信公众平台后台设置(https://blog.csdn.net/hicoldcat/article/details/54288245

微信小程序使用豆瓣API接口

勾上就可以了

相关文章:

  • 2022-01-01
  • 2021-08-12
  • 2021-07-12
  • 2021-12-30
  • 2022-01-04
  • 2021-11-06
  • 2022-01-01
  • 2022-01-01
猜你喜欢
  • 2021-12-11
  • 2022-01-01
  • 2021-05-17
  • 2021-12-03
  • 2021-04-12
  • 2022-02-06
  • 2021-12-17
相关资源
相似解决方案