微信小游戏代码中,如何解决无法读取undefined的__proto__属性错误?

2026-04-02 12:541阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计183个文字,预计阅读时间需要1分钟。

微信小游戏代码中,如何解决无法读取undefined的__proto__属性错误?

在Chrome浏览器中运行无问题,移植至微信小程序后亦然。继承关系:upPencil -> extend -> pencils -> extend -> sprite123456789101112export class upPenc

在chrome下没问题,移植到微信小程序就。。继承关系: upPencil extend pencils extend sprite123456789101112export class upPenc

在chrome下没问题,移植到微信小程序就。。继承关系: upPencil extend pencils extend sprite

微信小游戏代码中,如何解决无法读取undefined的__proto__属性错误?

123456789101112export class upPencil extends pencils{    constructor(passTop){        const image = dataStore.getInstance().res.get('upPencil');        const y = passTop - image.height;        super(image,y);        this.type = "up"    }    draw(){                                   super.draw()    }}

调用开始处:

1   pencil.draw(); //画出每个铅笔

pencils中出错位置

1            _get(pencils.prototype.__proto__ || Object.getPrototypeOf(pencils.prototype), "draw", this).call(this);

pencil中出错位置

1234567    _createClass(upPencil, [{        key: "draw",        value: function draw() {            //this.y = this.top -this.srcH;            _get(upPencil.prototype.__proto__ || Object.getPrototypeOf(upPencil.prototype), "draw", this).call(this);        }    }]);

本文共计183个文字,预计阅读时间需要1分钟。

微信小游戏代码中,如何解决无法读取undefined的__proto__属性错误?

在Chrome浏览器中运行无问题,移植至微信小程序后亦然。继承关系:upPencil -> extend -> pencils -> extend -> sprite123456789101112export class upPenc

在chrome下没问题,移植到微信小程序就。。继承关系: upPencil extend pencils extend sprite123456789101112export class upPenc

在chrome下没问题,移植到微信小程序就。。继承关系: upPencil extend pencils extend sprite

微信小游戏代码中,如何解决无法读取undefined的__proto__属性错误?

123456789101112export class upPencil extends pencils{    constructor(passTop){        const image = dataStore.getInstance().res.get('upPencil');        const y = passTop - image.height;        super(image,y);        this.type = "up"    }    draw(){                                   super.draw()    }}

调用开始处:

1   pencil.draw(); //画出每个铅笔

pencils中出错位置

1            _get(pencils.prototype.__proto__ || Object.getPrototypeOf(pencils.prototype), "draw", this).call(this);

pencil中出错位置

1234567    _createClass(upPencil, [{        key: "draw",        value: function draw() {            //this.y = this.top -this.srcH;            _get(upPencil.prototype.__proto__ || Object.getPrototypeOf(upPencil.prototype), "draw", this).call(this);        }    }]);