diff --git a/demoHtml/flex/css/index.css b/demoHtml/flex/css/index.css index 72107d3..b42ed3d 100644 --- a/demoHtml/flex/css/index.css +++ b/demoHtml/flex/css/index.css @@ -149,10 +149,14 @@ html { position: relative; overflow-y: auto; padding: 10px; + display: flex; + align-items: center; + justify-content: center; } .grid-stack { background-color: #f9fafb; border-radius: 8px; + width: 960px; } .grid-stack-item-content { cursor: pointer; diff --git a/demoHtml/flex/js/index.js b/demoHtml/flex/js/index.js index 40182fd..7fa0b72 100644 --- a/demoHtml/flex/js/index.js +++ b/demoHtml/flex/js/index.js @@ -2,7 +2,7 @@ let initData = null; let grid = null; let currentComponent = null; - let cellHeight = 40; + let cellHeight = 60; // 生成唯一id var generateUniqueId = function () { @@ -36,8 +36,9 @@ // 一行高度 cellHeight, // 间距 - margin: 5, - minRow: Math.floor(($(window).height() - 80) / cellHeight), + margin: 0, + minRow: Math.floor(1080 / 2 / cellHeight), + maxRow: Math.floor(1080 / 2 / cellHeight), acceptWidgets: true, float: true, removable: '#trash', @@ -48,7 +49,7 @@ GridStack.setupDragIn('#components-panel .component-item', undefined, [ { w: 2, - h: 4, + h: 2, type: 'image', name: '图片', image: '', @@ -62,7 +63,7 @@ }, { w: 2, - h: 2, + h: 1, type: 'text', childrenType: '', name: '文本', @@ -302,7 +303,7 @@ item.xCopy = item.x; item.x = item.x * (1920 / 12); item.yCopy = item.y; - item.y = item.y * cellHeight; + item.y = item.y * cellHeight * 2; item.wCopy = item.w; item.w = item.w * (1920 / 12); @@ -310,7 +311,7 @@ item.h = 1; } item.hCopy = item.h; - item.h = item.h * cellHeight; + item.h = item.h * cellHeight * 2; }); console.log(initDataCopy); return initDataCopy;