Merge pull request #8082 from dataease/pr@dev-v2_dzz_mobile

fix(嵌入式): iframe嵌入高度丢失
This commit is contained in:
dataeaseShu 2024-02-20 15:50:38 +08:00 committed by GitHub
commit e16635f3b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 5 deletions

View File

@ -49,7 +49,7 @@
</configuration>
</execution>
<!--前端组件有更新需要放开-->
<execution>
<!-- <execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
@ -57,7 +57,7 @@
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
</execution> -->
<execution>
<id>npm run build</id>

View File

@ -211,7 +211,6 @@ export function getCanvasStyle(canvasStyleData) {
style['background'] = colorRGBA
}
}
console.log('style', style)
return style
}

View File

@ -1,5 +1,6 @@
<script lang="ts" setup>
import { shallowRef, defineAsyncComponent } from 'vue'
import { shallowRef, defineAsyncComponent, ref, onBeforeUnmount } from 'vue'
import { debounce } from 'lodash-es'
import { useEmbedded } from '@/store/modules/embedded'
import { useAppStoreWithOut } from '@/store/modules/app'
import { useRoute } from 'vue-router'
@ -50,11 +51,27 @@ const init = () => {
embeddedStore.setType(type)
currentComponent.value = componentMap[type || 'ViewWrapper']
}
const iframeStyle = ref(null)
const setStyle = debounce(() => {
iframeStyle.value = {
height: window.innerHeight + 'px',
width: window.innerWidth + 'px'
}
}, 300)
onBeforeMount(() => {
window.addEventListener('resize', setStyle)
setStyle()
init()
})
onBeforeUnmount(() => {
window.removeEventListener('resize', setStyle)
})
</script>
<template>
<component :is="currentComponent"></component>
<div :style="iframeStyle">
<component :is="currentComponent"></component>
</div>
</template>