- 进入项目根目录,安装polyfill
npm install wepy-async-function --save
- 在app.wpy中引入polyfill
import 'wepy-async-function';
- 在app.wpy中使API promise化
export default class extends wepy.app {
constructor () {
super();
this.use('promisify');
}
}
官网https://github.com/Tencent/wepy/wiki/wepy%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8Promise
网友评论