微信小程序:封装wx.request同步请求
引入在开发小程序的过程中,通过wx.request()对后端接口进行请求是不可避免的。wx.request({ url: 'http://localhost:8080/getTopTheme', method: 'GET', data: {}, success: res => { this.setData({ topThemeSrc: res.data.src }) }})这是一段非常普通的请求接口的代码,感觉上来所是有点长的,并且在一个页面中
原创
2020-06-27 21:58:56 ·
10552 阅读 ·
2 评论