chore: 悦码渲染器不拦截请求的响应

This commit is contained in:
wangxuefeng
2025-03-21 18:47:44 +08:00
parent 4c59bfeb61
commit 69ccd6a48d
6 changed files with 39 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@sy/wujie-vue3-renderer-adapter",
"version": "1.0.0-alpha.5",
"version": "1.0.0-alpha.7",
"description": "wujie-vue3 ycode renderer adapter",
"type": "module",
"scripts": {

View File

@@ -49,6 +49,19 @@ const props = withDefaults(
const { bus } = WujieVue;
// 定义无界插件
const wujiePlugins = [
{
patchElementHook(element: Element, iframeWindow: Window) {
if (element.nodeName === 'STYLE') {
element.insertAdjacentElement = function (_position, ele) {
iframeWindow.document.head.append(ele);
};
}
},
},
];
// 生命周期钩子
const beforeLoad = (appWindow: Window) => {
console.log(`${props.name} 开始加载`, appWindow);
@@ -110,15 +123,15 @@ onBeforeUnmount(() => {
<template>
<WujieVue
:id="`wujie-vue3-adapter-${fileId}`"
:name="name || fileId"
:url="finalUrl"
:sync="sync"
width="100%"
height="100%"
:degrade="degrade"
:props="subAppProps"
:before-load="beforeLoad"
:after-mount="afterMount"
:interceptors="interceptors"
:plugins="wujiePlugins"
/>
</template>