You could try using styles instead of removing and appending the element, something like this:(您可以尝试使用样式,而不是删除和附加元素,如下所示:)
<div id="test" class="overlay hidden"></div>
with CSS:(使用CSS:)
.hidden {
display: none;
}
Then remove the class on prerender
and add it on postrender
.(然后在prerender
上删除该类,并在postrender
上添加它。)
Otherwise, you could try console logging document.getElementsByTagName('body')[0]
and myDiv
to see if the correct element is being appended to the correct parent.(否则,您可以尝试控制台记录document.getElementsByTagName('body')[0]
和myDiv
以查看是否将正确的元素附加到正确的父对象上。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…