chore: 排查无界加载异常的问题

This commit is contained in:
wangxuefeng
2025-03-19 00:08:19 +08:00
parent a2d308bc1a
commit 9b39f265d3
12 changed files with 369 additions and 260 deletions

View File

@@ -43,7 +43,8 @@ const initPostmate = async () => {
console.log('finalUrl', finalUrl);
const connection = new Postmate({
container,
classListArray: ['low-code-adapter-iframe'],
container: document.querySelector('#low-code-adapter'),
model: {
accessToken: props.accessToken,
// 其他参数仍然保留在 model 中,以保持兼容性
@@ -57,12 +58,16 @@ const initPostmate = async () => {
url: finalUrl,
});
connection.then((child) => {
child.frame.style.height = '100%';
child.frame.style.width = '100%';
connection.then((ctx) => {
console.log('ctx', ctx);
console.log('ctx.parent', ctx.parent);
console.log('ctx.parent.innerHeight', ctx.parent.innerHeight);
ctx.frame.style.height = `${ctx.parent.innerHeight - 38 - 88}px`;
ctx.frame.style.minHeight = `800px`;
ctx.frame.style.width = '100%';
// @ts-ignore 忽略 console
console.log(`${props.name} 连接成功`, child);
child.call('child-connected', {
console.log(`${props.name} 连接成功`, ctx);
ctx.call('child-connected', {
name: props.name,
});
});
@@ -74,19 +79,11 @@ onMounted(() => {
</script>
<template>
<div
id="low-code-adapter"
class="low-code-adapter"
style="width: 100%; height: 100%"
></div>
<div id="low-code-adapter"></div>
</template>
<style scoped>
.low-code-adapter {
width: 100%;
}
.low-code-adapter iframe {
<style>
.low-code-adapter-iframe {
width: 100%;
height: 100%;
border: none;

View File

@@ -28,13 +28,14 @@
"dependencies": {
"postmate": "catalog:",
"vue": "catalog:",
"wujie-vue3": "1.0.13"
"wujie-vue3": "1.0.22"
},
"devDependencies": {
"@farmfe/cli": "^1.0.4",
"@farmfe/core": "^1.7.1",
"@types/postmate": "catalog:",
"@vitejs/plugin-vue": "catalog:",
"vite-plugin-dts": "catalog:"
"vite-plugin-dts": "catalog:",
"vue-router": "catalog:"
}
}

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import type { Router, RouteRecordRaw } from 'vue-router';
import { onBeforeUnmount, onMounted } from 'vue';
import WujieVue from 'wujie-vue3';
@@ -8,11 +10,15 @@ import { version } from '/package.json';
const props = defineProps<{
[key: string]: any;
accessToken?: string;
applicationId: number | string;
applicationId: number;
degrade?: boolean;
fileId: number | string;
getRouter: () => Router;
name: string;
projectId: number | string;
// 传递给子应用的参数 payload
payload?: Record<string, any>;
projectId: number;
route: RouteRecordRaw;
sync: boolean;
url: string;
}>();