Merge pull request #10695 from dataease/pr@dev-v2@fix_template-import

fix(数据大屏): 修复数据大屏导入模版后,组合图层大小不一致问题 #10144
This commit is contained in:
王嘉豪 2024-07-02 12:52:32 +08:00 committed by GitHub
commit 3cb4e31ddd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View File

@ -1,10 +1,11 @@
<script setup lang="ts">
import { toRefs, computed, watch, nextTick } from 'vue'
import { toRefs, computed, watch, nextTick, onMounted } from 'vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
import CanvasGroup from '@/custom-component/common/CanvasGroup.vue'
import { deepCopy } from '@/utils/utils'
import { DEFAULT_CANVAS_STYLE_DATA_DARK } from '@/views/chart/components/editor/util/dataVisualiztion'
import { groupSizeStyleAdaptor } from '@/utils/style'
const dvMainStore = dvMainStoreWithOut()
const { canvasStyleData, curComponent } = storeToRefs(dvMainStore)
const sourceCanvasStyle = deepCopy(DEFAULT_CANVAS_STYLE_DATA_DARK)
@ -16,6 +17,7 @@ const props = defineProps({
},
element: {
type: Object,
required: true,
default() {
return {
propValue: null
@ -86,6 +88,12 @@ watch(
},
{ deep: true }
)
onMounted(() => {
nextTick(() => {
groupSizeStyleAdaptor(element.value)
})
})
</script>
<template>

View File

@ -8,7 +8,6 @@ import eventBus from '@/utils/eventBus'
import { adaptCurThemeCommonStyle } from '@/utils/canvasStyle'
import { composeStoreWithOut } from '@/store/modules/data-visualization/compose'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { groupSizeStyleAdaptor } from '@/utils/style'
const dvMainStore = dvMainStoreWithOut()
const composeStore = composeStoreWithOut()
@ -125,9 +124,6 @@ export const copyStore = defineStore('copy', {
index: componentData.value.length - 1
})
}
if (newComponent.component === 'Group') {
groupSizeStyleAdaptor(newComponent)
}
i++
}
}, moveTime)