From 09d3ce1e9c30b43e6c4748735a6dea1eef6ac58c Mon Sep 17 00:00:00 2001 From: element-bot Date: Fri, 18 Jun 2021 10:42:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0float=E9=80=89=E9=A1=B9?= =?UTF-8?q?=EF=BC=8C=E5=85=81=E8=AE=B8=20vue-grid-layout-item=20=E6=B5=AE?= =?UTF-8?q?=E5=8A=A8=E5=9C=A8=E5=9B=BA=E5=AE=9A=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/App.vue | 7 ++++++- src/components/GridItem.vue | 18 +++++++++++++++++- src/components/GridLayout.vue | 5 +++-- src/helpers/utils.js | 22 ++++++++++++---------- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 2cee15a2..f30b97a4 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ yarn.lock yarn-error.log website/docs/dist +website/public/ diff --git a/src/App.vue b/src/App.vue index ff152bc7..b2f7ddda 100644 --- a/src/App.vue +++ b/src/App.vue @@ -62,6 +62,7 @@ :w="item.w" :h="item.h" :i="item.i" + :float="item.float" :min-w="item.minW" :max-w="item.maxW" :min-x="item.minX" @@ -118,7 +119,7 @@ //var eventBus = require('./eventBus'); let testLayout = [ - {"x":0,"y":0,"w":2,"h":2,"i":"0", resizable: true, draggable: true, static: false, minY: 0, maxY: 2}, + {"x":0,"y":0,"w":2,"h":2,"i":"0", resizable: true, draggable: true, static: false, minY: 0, maxY: 2,float:true}, {"x":2,"y":0,"w":2,"h":4,"i":"1", resizable: null, draggable: null, static: true}, {"x":4,"y":0,"w":2,"h":5,"i":"2", resizable: false, draggable: false, static: false, minX: 4, maxX: 4, minW: 2, maxW: 2, preserveAspectRatio: true}, {"x":6,"y":0,"w":2,"h":3,"i":"3", resizable: false, draggable: false, static: false}, @@ -216,18 +217,22 @@ this.index++; this.layout.push(item); }, + // 移动的过程中触发 move: function(i, newX, newY){ console.log("MOVE i=" + i + ", X=" + newX + ", Y=" + newY); }, resize: function(i, newH, newW, newHPx, newWPx){ console.log("RESIZE i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx); }, + // 移动结束触发 moved: function(i, newX, newY){ console.log("### MOVED i=" + i + ", X=" + newX + ", Y=" + newY); }, + // grid item 大小变化时触发 resized: function(i, newH, newW, newHPx, newWPx){ console.log("### RESIZED i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx); }, + // grid layout 大小变化时触发 containerResized: function(i, newH, newW, newHPx, newWPx){ console.log("### CONTAINER RESIZED i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx); }, diff --git a/src/components/GridItem.vue b/src/components/GridItem.vue index d539dce1..19d6e23e 100644 --- a/src/components/GridItem.vue +++ b/src/components/GridItem.vue @@ -84,6 +84,9 @@ .vue-grid-item.disable-userselect { user-select: none; } + .vue-grid-item.float{ + z-index: 1; + }