a-node.js 类型错误:无法读取未定义的属性'constructor'



当我加载我的aframe项目时,我收到此错误,不知道如何跟踪它在我的代码中指示的任何问题。使用 https://aframe.io/releases/0.9.2/aframe.min.js

以下是整个跟踪:

core:a-node:error Failure loading node:   TypeError: Cannot read property 'constructor' of undefined
at extendProperties (component.js:734)
at i.callUpdateHandler (component.js:414)
at i.updateProperties (component.js:298)
at HTMLElement.updateComponent (a-entity.js:490)
at HTMLElement.updateComponents (a-entity.js:456)
at a-entity.js:249
at a-node.js:127

如何判断哪个节点在这里出现问题?欢迎任何跟踪问题的建议。

FWIW,这与此处报告的 v0.8.2 问题的堆栈跟踪几乎相同 https://github.com/aframevr/aframe/issues/3920 .据报道,这是固定的,我不知道它是否重要,但也许它有助于向某人建议这是怎么回事? 由于该错误似乎与相机有关,因此让我展示我的相机实体:

<a-entity id="mainCameraRig">
<a-entity camera
id="mainCamera"
wasd-controls
look-controls>
</a-entity>
</a-entity>

也许这有什么问题?

谢谢。

我想详细说明user3247073的答案。

添加超时值似乎奏效了。

我不确定您使用的是什么堆栈,但实际上,这就是我解决问题的方式。我正在使用 Angular 和 Aframe v.1.3.0

组件.html

<a-scene *ngIf="aSceneLoaded">
<a-box></a-box>
<a-camera></a-camera>
</a-scene>

compontent.ts ...

aSceneLoaded = false; 
ngOnInit() {
this.loadAScene();
}    

loadAScene() {
setTimeout(() => {
this.aSceneLoaded = true;
}, 1000);
}

换句话说,当 Angular 组件初始化时(在其构造函数初始化之后(,我们调用函数 loadAScene,它启动超时。

最新更新