Skip to content

Commit 3edc562

Browse files
authored
Merge pull request jbaysolutions#17 from ThePlastic/master
Get Item on change
2 parents 684ec6a + 25df618 commit 3edc562

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/App.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
:h="item.h"
3636
:min-w="2"
3737
:min-h="2"
38-
:i="item.i">
38+
:i="item.i"
39+
@resize="resize"
40+
@move="move">
3941
<test-element :text="item.i"></test-element>
4042
</grid-item>
4143
</grid-layout>
@@ -114,6 +116,12 @@
114116
this.index++;
115117
this.layout.push(item);
116118
},
119+
move: function(i, newX, newY){
120+
console.log(i, newX, newY)
121+
},
122+
resize: function(i, newH, newW){
123+
console.log(i, newH, newW)
124+
},
117125
/**
118126
* Add change direction button
119127
*/

src/GridItem.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@
375375
this.lastH = y;
376376
377377
eventBus.$emit("resizeEvent", event.type, this.i, this.x, this.y, pos.h, pos.w);
378+
this.$emit("resize", this.i, pos.h, pos.w);
378379
},
379380
handleDrag(event) {
380381
if (this.isResizing) return;
@@ -444,6 +445,7 @@
444445
this.lastY = y;
445446
446447
eventBus.$emit("dragEvent", event.type, this.i, pos.x, pos.y, this.h, this.w);
448+
this.$emit("move", this.i, pos.x, pos.y);
447449
},
448450
calcPosition: function(x, y, w, h) {
449451
const colWidth = this.calcColWidth();

0 commit comments

Comments
 (0)