feat:新增预览页面位置图表位置渲染功能

This commit is contained in:
mtruning
2022-03-06 16:54:48 +08:00
parent 4405ebd30d
commit 75232ee902
8 changed files with 107 additions and 24 deletions
+21
View File
@@ -0,0 +1,21 @@
import { PickCreateComponentType } from '@/packages/index.d'
type AttrType = PickCreateComponentType<'attr'>
export const useComponentStyle = (attr: AttrType, index: number) => {
const componentStyle = {
zIndex: index + 1,
left: `${attr.x}px`,
top: `${attr.y}px`
}
return componentStyle
}
export const useSizeStyle = (attr: AttrType, scale?: number) => {
const sizeStyle = {
width: `${scale ? scale * attr.w : attr.w}px`,
height: `${scale ? scale * attr.h : attr.h}px`,
border: '1px solid red'
}
return sizeStyle
}