qmhc / grid-layout-plus

A draggable and resizable grid layout, for Vue 3.
https://grid-layout-plus.netlify.app/
MIT License
325 stars 40 forks source link

如何实现从一个GridLayout中拖放到另一个GridLayout #21

Open touchrank-dev opened 8 months ago

touchrank-dev commented 8 months ago

尝试过在GridItem移动事件中,删除源GridLayout中的layout数组中的item,再插入到目标GridLayout的layout数组中,但这样会引发handleDrag中的异常:

  if (!mouseInGrid) {
    let draggingIndex = layoutData.value[0].findIndex(ele => ele.i === itemId)
    let removed = layoutData.value[0].splice(draggingIndex, 1)
    console.log(layoutData.value[0], removed)
  }

大概可以模仿drag-from-outside例子,但先要解决拖少源GridItem时从源数组上删除该项引发异常?

touchrank commented 4 months ago

我在这个分支中实现了多网格间移动项目:但不完善