如何从A-Frame中的组件.init()
功能中获取场景?
AFRAME.registerComponent('foo', {
init: function () {
// ?
}
});
答案 0 :(得分:1)
https://aframe.io/docs/0.4.0/core/component.html#component-prototype-properties
AFRAME.registerComponent('foo', {
init: function () {
console.log(this.el.sceneEl);
},
update: function () {
console.log(this.el.sceneEl);
}
});