A帧内容在Chrome上不呈现,而在FireFox和Safari上呈现。
根据CodePen在这里 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>
`;
}
}
document.body.appendChild(new Box().render());我确信我遗漏了一些东西,在所有浏览器(CodePen)中,同样的内容呈现得与静态HTML一样好。
<body>
<a-scene>
<a-box color="red" position="0 2 -5" rotation="0 45 45" scale="2 2 2"></a-box>
</a-scene>
</body>发布于 2017-10-18 19:01:27
Update:我已经强制-修复了hyperHTML中的问题,即使它是关于AFrame uaing Custom V0的。一旦AFrame迁移到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}`;但我不得不在结尾加上一句非常丑陋的话:
// if you comment this out nothing works
document.body.innerHTML = document.body.innerHTML;这是因为AFrame使用了一个自定义元素polyfill (实际上是我的),当从模板节点克隆它时,它似乎不会触发注册表。
有一个一个已知的问题,我从来没有能够复制,这可能是我正在寻找的用例。
不幸的是,现在看来,AFrame组件在使用hyperHTML时可能会遇到麻烦。
抱歉,我会尽快解决这个问题的。
发布于 2017-10-20 18:40:25
为了澄清误解,已经证实这不是一个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);如果不包括AFrame之外的任何额外库,也会失败。
有一个正在进行的调查,但您应该注意的是,任何基于现代模板元素的库,以产生通用内容将失败的aframe 0.7和仅在Chrome。
更新 臭虫档案在AFrame存储库中
https://stackoverflow.com/questions/46797635
复制相似问题