跳到主要内容

布局 Layout

Layout 提供了 TiRowTiCol 两个组件来进行行列布局。

安装使用

import { TiRow, TiCol } from '@titian-design/mobile-vue';

用法示例

栅格配置

栅格占位格数,为 0 时相当于 display: none

<template>
<TiRow>
<TiCol :span="24">span-24</TiCol>
</TiRow>

<TiRow>
<TiCol :span="12">span-12</TiCol>
<TiCol :span="12">span-12</TiCol>
</TiRow>

<TiRow>
<TiCol :span="8">span-8</TiCol>
<TiCol :span="8">span-8</TiCol>
<TiCol :span="8">span-8</TiCol>
</TiRow>

<TiRow>
<TiCol :span="6">span-6</TiCol>
<TiCol :span="6">span-6</TiCol>
<TiCol :span="6">span-6</TiCol>
<TiCol :span="6">span-6</TiCol>
</TiRow>
</template>

<script lang="ts" setup>
import { TiRow, TiCol } from '@titian-design/mobile-vue';
</script>

偏移量设置

栅格左侧的偏移格数

<template>
<TiRow>
<TiCol :offset="12" :span="12">offset-12 span-12</TiCol>
</TiRow>

<TiRow>
<TiCol :span="8">span-8</TiCol>
<TiCol :offset="8" :span="8">offset-8 span-8</TiCol>
</TiRow>

<TiRow>
<TiCol :offset="6" :span="6">offset-6 span-6</TiCol>
<TiCol :offset="6" :span="6">offset-6 span-6</TiCol>
</TiRow>
</template>

<script lang="ts" setup>
import { TiRow, TiCol } from '@titian-design/mobile-vue';
</script>

配置栅格间隔

<template>
<TiRow :gutter="16">
<TiCol :span="12">gutter-16 span-12</TiCol>
<TiCol :span="12">gutter-16 span-12</TiCol>
</TiRow>

<TiRow :gutter="12">
<TiCol :span="12">gutter-12 span-12</TiCol>
<TiCol :span="12">gutter-12 span-12</TiCol>
</TiRow>
</template>

<script lang="ts" setup>
import { TiRow, TiCol } from '@titian-design/mobile-vue';
</script>

使用浮动布局

<template>
<TiRow :flex="false">
<TiCol :span="12">span-12</TiCol>
<TiCol :span="12">span-12</TiCol>
</TiRow>
</template>

<script lang="ts" setup>
import { TiRow, TiCol } from '@titian-design/mobile-vue';
</script>

TiRow API

属性 Properties

名称类型是否必填默认值说明备注
flexbooleantrue是否启用 flex 布局, 当值为false时,使用浮动布局-
gutternumber0列元素之间的距离-

可扩展样式名 External Class

类名说明备注
ext-class根节点可扩展的类名-

TiCol API

属性 Properties

名称类型是否必填默认值说明备注
spannumber-栅格占位格数,为 0 时相当于 display: none-
offsetnumber-栅格左侧的偏移格数-

可扩展样式名 External Class

类名说明备注
ext-class根节点可扩展的类名-