用于将微信小程序无接口请求, API异步函数封装为 Promise 风格
常用的API, 例如wx.login
const promisify from 'index.js'
const login = promisify(wx.login)
login()
.then(res => {
console.log(res.code)
})
网络请求:wx.request()
const promisify from 'index.js';
const wxRequest = promisify(wx.request)
wxRequest({
urll,
data,
method
})
.then(() => {})
.catch(() => {})