美文网首页
小程序使用 generator

小程序使用 generator

作者: 反者道之动001 | 来源:发表于2018-08-13 16:33 被阅读71次

    小程序使用生成器函数
    附上连接 哈哈
    https://www.jsdelivr.com/package/npm/regenerator-runtime

    引入他就可以了
    引入runtime.js!!

    比如

    app.js

    var regeneratorRuntime = require('./utils/runtime/index')
    

    然后就可以愉快的使用了, 可以用co库也可以直接async

    比如我这样:

    async () => {
      let loginResult = await wx.Http.testModel['com/login'](datas)
      let infoResult = await wx.Http.testModel['com/info'](loginResult)
    }
    

    --END--

    相关文章

      网友评论

          本文标题:小程序使用 generator

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