美文网首页
微信小程序es7转es5的runtime.js库

微信小程序es7转es5的runtime.js库

作者: clinginglove | 来源:发表于2019-12-12 09:40 被阅读0次

1.在小程序的开发工具中,勾选es6转es5语法

2.下载Facebook的regenerator库中的regenerator/blob/master/packages/regenerator-runtime/runtime.js

3.在小程序目录下新建文件夹lib/runtime/runtime.js,将代码拷贝进去

4.在每个需要使用async语法的页面js文件中,都引入(不能全局引入)

runtime.js链接地址

引用方式:importregeneratorRuntimefrom'../../lib/runtime/runtime'

备注:只引用即可,就可以使用 async 加 await

相关文章

网友评论

      本文标题:微信小程序es7转es5的runtime.js库

      本文链接:https://www.haomeiwen.com/subject/liuzgctx.html