+
21
-

同一个iframe多次write包含three的html为啥报错不显示Failed to execute 'write' on 'Document': Identifier 'scene' has a

同一个iframe多次write包含three的html为啥报错不显示Failed to execute 'write' on 'Document': Identifier 'scene' has already been declare,这个怎么解决?

const iframe = document.getElementById('previewFrame');
if(iframe) {
const doc = iframe.contentDocument || iframe.contentWindow.document;
doc.open();
doc.write(html);
doc.close();
}


网友回复

我知道答案,我要回答