wepy 2.0
作者:互联网
一。使用promisify(async 和await)
(1)微信开发工具需要勾选增强编译
(2)需要引入@wepy/use-promiseify包,在入口文件app.wpy中
import promisify from '@wepy/use-promisify'; wepy.use(promisify);
(3)在发送请求时,需要在变wepy.request为wepy.wx.request
async created () { const data= await wepy.wx.request({ url: 'https://uinav.com/api/public/v1/home/floordata' }) } console.log(data) });
标签:promisify,use,await,request,wepy,2.0,data 来源: https://www.cnblogs.com/star-meteor/p/14671837.html