Skip to content

Grid

演示

Grid 跨端示例与演示

常用服务账户快捷入口
8
2我的订单
物流
3优惠券
收藏
收货地址
客服
发票
设置

基础用法

vue
<template>
  <VGrid :border="false" :gutter="8">
    <VGridItem text="订单">
      <template #icon>
        <img src="/icons/orders.svg" alt="">
      </template>
    </VGridItem>
    <VGridItem text="物流">
      <template #icon>
        <img src="/icons/delivery.svg" alt="">
      </template>
    </VGridItem>
    <VGridItem text="收藏">
      <template #icon>
        <img src="/icons/favorite.svg" alt="">
      </template>
    </VGridItem>
    <VGridItem text="设置">
      <template #icon>
        <img src="/icons/settings.svg" alt="">
      </template>
    </VGridItem>
  </VGrid>
</template>

列数与间距

vue
<template>
  <VGrid :column-num="3" :gutter="8">
    <VGridItem text="入口" />
    <VGridItem text="入口" />
    <VGridItem text="入口" />
  </VGrid>
</template>

徽标与点击态

vue
<template>
  <VGrid clickable>
    <VGridItem text="消息" badge="3">
      <template #icon>
        <img src="/icons/message.svg" alt="">
      </template>
    </VGridItem>
    <VGridItem text="提醒" dot>
      <template #icon>
        <img src="/icons/notice.svg" alt="">
      </template>
    </VGridItem>
  </VGrid>
</template>

Grid Props

Prop类型默认值描述
columnNumnumber | string4列数
gutternumber | stringundefined宫格间距
borderbooleantrue是否显示边框态
squarebooleanfalse是否方形格子
centerbooleantrue是否居中内容
clickablebooleanfalse是否开启点击态
direction'vertical' | 'horizontal''vertical'内容方向

GridItem Props

Prop类型默认值描述
textstringundefined文本
iconstringundefined图标内容
badgenumber | stringundefined徽标内容
dotbooleanfalse是否显示小红点
urlstringundefined链接地址
tostringundefined路由链接
spannumber | string1跨列数量
clickableboolean | undefinedundefined覆盖父级点击态

Slots

Slot描述
defaultGrid 内容或 GridItem 自定义内容
icon自定义图标
text自定义文本