# Grid 欄格

24 列欄格系統。LhRow 排列與間距,LhCol 跨度、偏移與回應式斷點。

欄格
<template>
  <div>
    <p class="demo-note">基礎欄格(24 列)+ gutter 間距</p>
    <LhRow :gutter="16">
      <LhCol :span="8"><div class="grid-cell">span=8</div></LhCol>
      <LhCol :span="8"><div class="grid-cell">span=8</div></LhCol>
      <LhCol :span="8"><div class="grid-cell">span=8</div></LhCol>
    </LhRow>
    <p class="demo-note">offset / push / pull</p>
    <LhRow :gutter="12">
      <LhCol :span="6" :offset="6"><div class="grid-cell">offset=6</div></LhCol>
      <LhCol :span="6" :push="6"><div class="grid-cell">push=6</div></LhCol>
    </LhRow>
    <p class="demo-note">對齊:justify / align</p>
    <LhRow
      justify="center"
      align="middle"
      style="height: 60px; background: var(--lh-bg-color-page, #f6f1ea); border-radius: 6px"
    >
      <LhCol :span="6"><div class="grid-cell">置中</div></LhCol>
    </LhRow>
    <p class="demo-note">回應式斷點::sizes=&#123; xs: 24, sm: 12, md: 8 &#125;</p>
    <LhRow :gutter="12">
      <LhCol v-for="i in 6" :key="i" :sizes="{ xs: 24, sm: 12, md: 8 }">
        <div class="grid-cell">回應列 {{ i }}</div>
      </LhCol>
    </LhRow>
  </div>
</template>

提示

demo 的 .grid-cell 只是範例樣式(灰底圓角),庫本身不提供。

# Row Props

屬性 說明 類型 預設值
justify 主軸排列 'start' \| 'end' \| 'center' \| 'space-between' \| 'space-around' 'start'
align 交叉軸對齊 'top' \| 'middle' \| 'bottom' 'top'
gutter 列間距(px 或 [橫向, 縱向]) number \| [number, number] 0
wrap 允許換行 boolean true
sx sx 快速佈局屬性 — —

# Col Props

屬性 說明 類型 預設值
span 佔據列數(24 欄格制) number —
offset 左側偏移列數 number 0
push 向右平移列數 number 0
pull 向左平移列數 number 0
xs / sm / md / lg / xl 斷點跨度:<640 / ≥640 / ≥768 / ≥1024 / ≥1280px number —
sizes 按斷點批量宣告(與 xs~xl 等價) { xs?, sm?, md?, lg?, xl? } —
sx sx 快速佈局屬性 — —

Copyright © 2024-2026 风默文学 | 宁ICP备2024006574号 | 公安备案徽标苏公网安备32040002010537