美文网首页
解决方案:Class extends value #

解决方案:Class extends value #

作者: 灬小白 | 来源:发表于2019-09-27 14:06 被阅读0次
var Father = {
    // ...
}
class Child extends Father {
     // ...
}
// Uncaught TypeError: Class extends value #<Object> is not a constructor or null
 
// 解决方案
Object.setPrototypeOf(Child.prototype, Father);

如果Father是引用进来的,看下在导出的时候是不是写的是module.export,正确的写法为:
module.exports = Father

相关文章

网友评论

      本文标题:解决方案:Class extends value #

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