!64 fix: 修复隐藏组件预览状态下的异常

Merge pull request !64 from dodu/dev-commet
This commit is contained in:
奔跑的面条 2022-09-29 06:59:34 +00:00 committed by Gitee
commit b6ac93ae63
3 changed files with 16 additions and 7 deletions

View File

@ -7,7 +7,8 @@
:style="{ :style="{
...getComponentAttrStyle(item.attr, groupIndex), ...getComponentAttrStyle(item.attr, groupIndex),
...getFilterStyle(item.styles), ...getFilterStyle(item.styles),
...getTransformStyle(item.styles) ...getTransformStyle(item.styles),
...getStatusStyle(item.status)
}" }"
> >
<component <component
@ -24,7 +25,7 @@
import { PropType } from 'vue' import { PropType } from 'vue'
import { CreateComponentGroupType } from '@/packages/index.d' import { CreateComponentGroupType } from '@/packages/index.d'
import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils' import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils'
import { getSizeStyle, getComponentAttrStyle } from '../../utils' import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
const props = defineProps({ const props = defineProps({
groupData: { groupData: {

View File

@ -7,7 +7,8 @@
:style="{ :style="{
...getComponentAttrStyle(item.attr, index), ...getComponentAttrStyle(item.attr, index),
...getFilterStyle(item.styles), ...getFilterStyle(item.styles),
...getTransformStyle(item.styles) ...getTransformStyle(item.styles),
...getStatusStyle(item.status)
}" }"
> >
<!-- 分组 --> <!-- 分组 -->
@ -38,7 +39,7 @@ import { PreviewRenderGroup } from '../PreviewRenderGroup/index'
import { CreateComponentGroupType } from '@/packages/index.d' import { CreateComponentGroupType } from '@/packages/index.d'
import { chartColors } from '@/settings/chartThemes/index' import { chartColors } from '@/settings/chartThemes/index'
import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils' import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils'
import { getSizeStyle, getComponentAttrStyle } from '../../utils' import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
const props = defineProps({ const props = defineProps({
localStorageInfo: { localStorageInfo: {

View File

@ -2,7 +2,7 @@ import { PickCreateComponentType } from '@/packages/index.d'
import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
type AttrType = PickCreateComponentType<'attr'> type AttrType = PickCreateComponentType<'attr'>
type StylesType = PickCreateComponentType<'styles'> type StatusType = PickCreateComponentType<'status'>
// 设置位置 // 设置位置
export const getComponentAttrStyle = (attr: AttrType, index: number) => { export const getComponentAttrStyle = (attr: AttrType, index: number) => {
@ -16,10 +16,17 @@ export const getComponentAttrStyle = (attr: AttrType, index: number) => {
// 设置大小 // 设置大小
export const getSizeStyle = (attr: AttrType, scale?: number) => { export const getSizeStyle = (attr: AttrType, scale?: number) => {
return ({ return {
width: `${scale ? scale * attr.w : attr.w}px`, width: `${scale ? scale * attr.w : attr.w}px`,
height: `${scale ? scale * attr.h : attr.h}px` height: `${scale ? scale * attr.h : attr.h}px`
}) }
}
// 设置状态样式
export const getStatusStyle = (attr: StatusType) => {
return {
display: attr.hide ? 'none' : 'block'
}
} }
// 全局样式 // 全局样式