小程序使用promise封装一个网络请求

export default function(options) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: options.url,
      method: options.method || 'get',
      data: options.data || {},
      success: resolve,
      fail: reject
    })
  })
}
发布了61 篇原创文章 · 获赞 15 · 访问量 4062

猜你喜欢

转载自blog.csdn.net/qq_44162474/article/details/104740255