Bootstrap

微信小程序---API的promise化

1.实现API promise化

npm install --save [email protected]

2.构建miniprogram_npm,先把miniprogram_npm删除,再点击工具->构建npm

3.

4.页面使用

async getInfo(){
 const {data:res} =await wx.p.request({
    method:'GET',
    url:'https://applet-base-api-t.itheima.net/api/get',
    data:{
      name:'zhangsan',
      age:20
    }
  })
  console.log(res);
},

;