为了账号安全,请及时绑定邮箱和手机立即绑定

为什么这里抛出了一个错误?我有点费解,求解答。

为什么这里抛出了一个错误?我有点费解,求解答。

慕田峪7331174 2018-09-03 13:29:09
Item.prototype.add = function ( child ) {        // 在子元素容器中插入子元素         this.children.push ( child );        // 插入到当前组件元素树上         this.element.appendChild( child.getElement() );        return this;     };     Item.prototype.getElement = function () {        return this.element;     };Uncaught TypeError: child.getElement is not a function这是怎么回事呢?
查看完整描述

1 回答

?
猛跑小猪

TA贡献1858条经验 获得超8个赞

你传入的child 的原型链上层没有有getElement方法, 有可能是child没有关联上Item.prototype。


查看完整回答
反对 回复 2018-10-18
  • 1 回答
  • 0 关注
  • 458 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号