2022-02-01 17:12:16 +08:00

24 lines
420 B
TypeScript

interface AttrType {
x: number
y: number
w: number
h: number
}
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) => {
const sizeStyle = {
width: `${attr.w}px`,
height: `${attr.h}px`
}
return sizeStyle
}