SOURCE

console 命令行工具 X clear

                    
>
console
var sceneEl = document.querySelector('a-scene');
console.log(sceneEl.querySelector('#redBox'));
AFRAME.registerComponent('log', {
    schema: { type: 'string' },
    init: function () {
        var stringToLog = this.data;
        console.log(stringToLog);
    }
});
<script src="https://aframe.io/releases/1.1.0/aframe.min.js">

</script>
<script src="https://unpkg.com/aframe-physics-system@1.4.0/dist/aframe-physics-system.min.js">

</script>
<a-scene physics>
	<a-box log="Hello, Box!" position="-1 4 -3" rotation="0 45 0" color="#4CC3D9" dynamic-body></a-box>
	<a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4" static-body></a-plane>
	<a-sky color="#ECECEC"></a-sky>
	<a-box id="redBox" position="-1 4 -1" class="clickable" color="red"></a-box>
	<a-box id="redBox" color="red" position="-1 4 -3"></a-box>
	<a-entity light="type: ambient" position="0 4 -1"></a-entity>
	<a-entity light="type: directional" position="-1 4 -2"></a-entity>
</a-scene>