【发布时间】:2016-04-12 15:26:39
【问题描述】:
我正在使用 babel 进行转译。
我有class BaseComponent,它由class Logger 扩展。
当我在浏览器中运行new Logger() 时,出现此错误
没有'new'就不能调用类构造函数BaseComponent
抛出这个的代码是:
var Logger = function (_BaseComponent) {
_inherits(Logger, _BaseComponent);
function Logger() {
_classCallCheck(this, Logger);
return _possibleConstructorReturn(this, Object.getPrototypeOf(Logger).call(this, "n")); //throws here
}
【问题讨论】:
-
这是babel的输出,还是你写的代码? (如果这是输出,请显示您编写的代码。)
-
什么是
BaseComponent? -
@loganfsmyth 只是一个 ES6 类
标签: ecmascript-6 babeljs