Skip to content

🎁 Apis

Parameter type

ts
interface LayoutItem {
    id: string
    x: number
    y: number
    h: number
    w: number
    static?: boolean
}

type Layout = LayoutItem[]

GridLayout

Props

ts
interface PropsData {
    data: Layout // Layout data
    col?: number | string, // columns
    rowH?: number | string // row height
    gutter?: number | string // gutter
    drage?: boolean // drage
    resize?: boolean // resize
    remove?: boolean // remove
    isDrawGridLines?: boolean // Whether to draw gridlines
    isCollision?: boolean // Collision or no collision
}
NameTypeDefaultDescription
dataLayout[]布局数据,支持双向绑定(v-model:data="layoutData")
colnumber/string12列数
rowHnumber/string50行高
gutternumber/string10网格间距
dragebooleantrue是否可拖拽
resizebooleantrue是否可缩放
removebooleantrue是否可删除
isDrawGridLinesbooleantrue是否绘制网格线
isCollisionbooleantrue是否碰撞

🪢 Events

NameDescriptionType
draggableStartTriggered when dragging starts(index: string) => void
draggableHandleTriggered in Drag(id: string, newItem: LayoutItem) => void
draggableEndTriggered when dragging end(id: string, newItem: LayoutItem) => void
removeTriggered by deleting a square(index: string) => void

GridItem

Props

ts
interface GridItem {
    id: string // unique identification
    draggableFrom?: string // Drag source, id of the element that triggered the drag
}
NameTypeDefaultDescription
idstring``unique identification
draggableFromstring``Drag source, id of the element that triggered the drag

🎍 Slot

NameDescription
defaultCustomize the content of each element
resizeCustom Zoom
removeCustomized Deletion