fix: 位置处理提取

This commit is contained in:
MTrun
2022-01-26 17:38:16 +08:00
parent 1e915bc873
commit a71180b71b
3 changed files with 29 additions and 16 deletions
@@ -0,0 +1,17 @@
interface AttrType {
x: number
y: number
w: number
h: number
}
export const useComponentStyle = (attr: AttrType, index: number) => {
const componentStyle = {
zIndex: index,
left: `${attr.x}px`,
top: `${attr.y}px`,
width: `${attr.w}px`,
height: `${attr.h}px`
}
return componentStyle
}