From bb6c104fcd0926e2ec29752c4b4b2c6390b3cf87 Mon Sep 17 00:00:00 2001 From: lichaojun Date: Sun, 14 Dec 2025 15:19:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8B=96=E6=8B=BD=E5=B8=83=E5=B1=80-?= =?UTF-8?q?=E7=94=BB=E5=B8=83=E5=9B=BA=E5=AE=9A1920*1080=EF=BC=8C=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=E4=B8=80=E5=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demoHtml/flex/css/index.css | 4 ++++ demoHtml/flex/js/index.js | 15 ++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) 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;