美文网首页
有关Decorator

有关Decorator

作者: JohnYuCN | 来源:发表于2019-09-26 12:54 被阅读0次

工作准备:

  1. 引入插件:
npm install babel-plugin-transform-decorators-legacy --save-dev
  1. 需要在项目的.babelrc中加入:
{
  "plugins": ["transform-decorators-legacy"]
}
  1. 使用:
babel --optional es7.decorators index.js > index.es5.js

实际使用中,可以不使用--optional

babel  index.js > index.es5.js

相关文章

网友评论

      本文标题:有关Decorator

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