diff --git a/src/views/preview/components/PreviewRenderGroup/index.vue b/src/views/preview/components/PreviewRenderGroup/index.vue index 4d0a813e..62b9b22a 100644 --- a/src/views/preview/components/PreviewRenderGroup/index.vue +++ b/src/views/preview/components/PreviewRenderGroup/index.vue @@ -7,9 +7,9 @@ :style="{ ...getComponentAttrStyle(item.attr, groupIndex), ...getFilterStyle(item.styles), - ...getTransformStyle(item.styles) + ...getTransformStyle(item.styles), + ...getStatusStyle(item.status) }" - v-show="!item.status.hide" > -type StylesType = PickCreateComponentType<'styles'> +type StatusType = PickCreateComponentType<'status'> // 设置位置 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) => { - return ({ + return { width: `${scale ? scale * attr.w : attr.w}px`, height: `${scale ? scale * attr.h : attr.h}px` - }) + } +} + +// 设置状态样式 +export const getStatusStyle = (attr: StatusType) => { + return { + display: attr.hide ? 'none' : 'block' + } } // 全局样式