小程序中支持es7的async语法

小程序中支持es7的async语法

  • es7的 async 号称是解决回调的最终⽅案
    1. 在⼩程序的开发⼯具中,勾选 es6转es5语法
    2. 下载 facebook的regenerator库中的
    3. 在⼩程序⽬录下新建⽂件夹 lib/runtime/runtime.js ,将代码拷⻉进去
    4. 在每⼀个需要使⽤async语法的⻚⾯的js⽂件中,都引⼊(不能全局引⼊)
import regeneratorRuntime from '../../lib/runtime/runtime';
posted @ 2021-01-30 15:38  journey-of-dreams  阅读(137)  评论(0编辑  收藏  举报