forked from github/dataease
Merge pull request #8082 from dataease/pr@dev-v2_dzz_mobile
fix(嵌入式): iframe嵌入高度丢失
This commit is contained in:
commit
e16635f3b1
@ -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>
|
||||
|
@ -211,7 +211,6 @@ export function getCanvasStyle(canvasStyleData) {
|
||||
style['background'] = colorRGBA
|
||||
}
|
||||
}
|
||||
console.log('style', style)
|
||||
return style
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
<div :style="iframeStyle">
|
||||
<component :is="currentComponent"></component>
|
||||
</div>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user