taro 2.0.6 异步编程配置不可用

Created on 12 Mar 2020  ·  8Comments  ·  Source: NervJS/taro

https://nervjs.github.io/taro/docs/async-await.html
根据该文档配置,async-await不可用

Most helpful comment

All 8 comments

CC @Chen-jj

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

怎么不可用

使用脚手架初始化项目
然后参照官方文档进行配置

"dependencies": {
    "@tarojs/components": "2.0.6",
    "@tarojs/components-qa": "2.0.6",
    "@tarojs/router": "2.0.6",
    "@tarojs/taro": "2.0.6",
    "@tarojs/taro-alipay": "2.0.6",
    "@tarojs/taro-h5": "2.0.6",
    "@tarojs/taro-qq": "2.0.6",
    "@tarojs/taro-quickapp": "2.0.6",
    "@tarojs/taro-rn": "2.0.6",
    "@tarojs/taro-swan": "2.0.6",
    "@tarojs/taro-tt": "2.0.6",
    "@tarojs/taro-weapp": "2.0.6",
    "babel-runtime": "^6.26.0",
    "lodash": "^4.17.15",
    "nerv-devtools": "^1.5.5",
    "nervjs": "^1.5.5"
  },
  "devDependencies": {
    "@tarojs/mini-runner": "^2.0.6",
    "@tarojs/webpack-runner": "2.0.6",
    "@types/react": "^16.4.6",
    "@types/webpack-env": "^1.13.6",
    "babel-eslint": "^8.2.3",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-jsx-stylesheet": "^0.6.5",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.6.1",
    "eslint": "^5.16.0",
    "eslint-config-taro": "2.0.6",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-react": "^7.8.2",
    "eslint-plugin-react-hooks": "^1.6.1",
    "eslint-plugin-taro": "2.0.6",
    "stylelint": "9.3.0",
    "stylelint-config-taro-rn": "2.0.6",
    "stylelint-taro-rn": "2.0.6"
  }
babel: {
    sourceMap: true,
    presets: [
      ['env', {
        modules: false
      }]
    ],
    plugins: [
      'transform-decorators-legacy',
      'transform-class-properties',
      'transform-object-rest-spread',
      ['transform-runtime', {
        "helpers": false,
        "polyfill": false,
        "regenerator": true,
        "moduleName": 'babel-runtime'
      }]
    ]
  },
  login = async () => {
    const res = await xxxxxx
  }

报错信息如下
image

在支付宝小程序中同样遇到这个报错,改用regenerator的runtime.js的话,支付宝小程序可以正常使用,但是微信小程序还是有同样的报错

感谢大佬,根据迁移指南里的方法,真的解决了!但是我是脚手架工具新建的2.x新项目,如果脚手架工具直接就帮我修改好,那就再好不过了!

@Garfield550 根据你的提示,已解决,多谢

Was this page helpful?
0 / 5 - 0 ratings