Angular-Gridster2 网格大小

alc*_*alc 5 css angular-gridster2

我目前正在致力于 angular-gridster2 的集成。目标是获得一个具有固定行高、固定列数的网格,并且应该计算大小。这是我当前的 GridsterConfig:

{
  setGridSize: true,
  margin: 5,
  displayGrid: DisplayGrid.OnDragAndResize,
  gridType: GridType.VerticalFixed,
  keepFixedHeightInMobile: true,
  fixedRowHeight: 50,
  minCols: 6,
  maxCols: 6,
  swap: true,
  pushItems: true,
  resizable: { enabled: true },
  draggable: {enabled: true },
  enableEmptyCellDrop: true,
}
Run Code Online (Sandbox Code Playgroud)

使用此配置,网格高度将按预期计算(完美)。问题是窗口大小调整后宽度保持不变。当我将 setGridSize 属性设置为 false 时,宽度计算按预期工作,但高度始终是边距的 2 倍。

alc*_*alc 0

我现在的解决方案是,我创建了一个父容器 div,在其中根据网格行设置高度(使用 rows * (fixedRowHeight + margin) 计算高度。