|
@@ -111,7 +111,12 @@ export const Model = defineComponent({
|
|
|
};
|
|
|
|
|
|
const interval = setInterval(async () => {
|
|
|
- const doc = iframeRef.value?.contentWindow?.document!
|
|
|
+ let doc: Document | undefined
|
|
|
+ try {
|
|
|
+ doc = iframeRef.value?.contentWindow?.document!
|
|
|
+ } catch {
|
|
|
+ clearInterval(interval);
|
|
|
+ }
|
|
|
if (!doc || !doc.querySelector("div")) return;
|
|
|
console.error(doc, doc.head)
|
|
|
const target = doc.head
|
|
@@ -127,7 +132,6 @@ export const Model = defineComponent({
|
|
|
`);
|
|
|
$style.appendChild(textNode);
|
|
|
target.appendChild($style);
|
|
|
- console.error(target, $style)
|
|
|
}
|
|
|
}, 16);
|
|
|
onCleanup(() => clearInterval(interval));
|