A-Frame 本地图像未加载

A-Frame local image is not loading

<!doctype html>
<html>
  <head>
    <script src="https://rawgit.com/aframevr/aframe/b813db0614ac2b518e547105e810b5b6eccfe1c8/dist/aframe.min.js"></script>
  </head>
  <body>
    <script>
      AFRAME.registerComponent('set-sky', {
        schema: {default: ''},
        init() {
          const sky = document.querySelector('a-sky');
          this.el.addEventListener('click', () => {
            sky.setAttribute('src', this.data);
          });
        }
      });
    </script>

    <a-scene>
      <a-camera position="0 2 4">
        <a-cursor color="#4CC3D9" fuse="true" timeout="10"></a-cursor>
      </a-camera>

      <a-sphere color="#F44336" radius="1" position="-4 2 0" set-sky="https://c3.staticflickr.com/2/1475/26239222850_cabde81c39_k.jpg"></a-sphere>

      <a-sphere color="#FFEB3B" radius="1" position="4 2 0" set-sky="32252838043_e8f2be6783_k.jpeg"></a-sphere>

      <a-sky></a-sky>
    </a-scene>
  </body>
</html>

我是 a-frame 的新手,在 java 脚本中也没有太多工作。上面的代码适用于引用图像,但不适用于本地图像。实际上我做错了什么?我找到了这个例子 here.

确保您使用的是本地服务器(例如 Mongoose、python -m SimpleHTTPServer 或 npm install live-server)并且图像与您的 index.html 位于同一路径你在哪里引用它的形式。

使用https://www.cesanta.com/products/binary,简单易用。无需以任何方式配置服务器结构。