Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用hyperHTML在Chrome上不呈现框架内容_Javascript_Three.js_Single Page Application_Aframe_Hyperhtml - Fatal编程技术网

Javascript 使用hyperHTML在Chrome上不呈现框架内容

Javascript 使用hyperHTML在Chrome上不呈现框架内容,javascript,three.js,single-page-application,aframe,hyperhtml,Javascript,Three.js,Single Page Application,Aframe,Hyperhtml,A-Frame内容在FireFox和Safari上渲染时不会在Chrome上渲染 依照 const{hyper,wire}=hyperHTML class Box extends hyper.Component { render() { return this.html` <a-scene> <a-box color="red" position="0 2 -5" rotation="0 45 45" scale="2 2 2"></a

A-Frame内容在FireFox和Safari上渲染时不会在Chrome上渲染

依照 const{hyper,wire}=hyperHTML

class Box extends hyper.Component {

  render() { return this.html`
    <a-scene>
        <a-box color="red" position="0 2 -5" rotation="0 45 45" scale="2 2 2"></a-box>
    </a-scene>
  `;
  }
}

document.body.appendChild(new Box().render());
类框扩展了hyper.Component{
render(){返回this.html`
)


更新:我已经在hyperHTML中强制修复了这个问题,即使它是关于使用自定义元素V0的框架。一旦框架迁移到V1,我将放弃强制修复

你的密码笔,我的也可以了。问候


我编写了几乎相同的代码:

const { hyper } = hyperHTML;

class Box extends hyper.Component {
  render() { return this.html`
    <a-scene>
          <a-box color="red"
            position="0 2 -5"
            rotation="0 45 45"
            scale="2 2 2"></a-box>
        </a-scene>`;
  }
}

hyper(document.body)`${new Box}`;
这是因为框架使用自定义元素polyfill(实际上是我的),当它从模板节点克隆时,它似乎不会触发注册表

有一点是,我从来没有能够复制,这可能是我一直在寻找的用例

不幸的是,现在看来框架组件可能在使用hyperHTML时遇到问题


很抱歉,我会尽快修复此问题。

为了澄清误解,已验证这不是hyperHTML错误

写下

const scene = `<a-scene>
  <a-box color="red" position="0 2 -5" rotation="0 45 45" scale="2 2 2"></a-box>
</a-scene>`;

var template = document.createElement('template');
template.innerHTML = scene;
document.body.appendChild(template.content);

const scene=`in AFrame repository

更新:Chrome是唯一一款采用CustomElements本机V0实现的浏览器,而AFrame正在使用该实现。这并不能解决问题,但至少解释了为什么其他浏览器都能正常工作。可能是AFrame需要更新其核心,但我会继续讨论s尽快。致以最良好的问候
// if you comment this out nothing works
document.body.innerHTML = document.body.innerHTML;
const scene = `<a-scene>
  <a-box color="red" position="0 2 -5" rotation="0 45 45" scale="2 2 2"></a-box>
</a-scene>`;

var template = document.createElement('template');
template.innerHTML = scene;
document.body.appendChild(template.content);