Skip to content

Vben Descriptions 描述列表

Descriptions 用于成组展示只读的字段信息,常用于详情页、信息预览等场景。组件基于 shadcn-ui 构建,API 参考 Ant Design Vue 的 Descriptions,支持响应式列数、跨列、边框、垂直布局等能力。

如果文档内没有覆盖到你需要的细节,可以结合在线示例一起查看。

写在前面

组件提供两种使用方式:通过 items 数据驱动(推荐),或通过子组件 VbenDescriptionsItem 声明列表项。两者可按需选择,items 优先级更高。:::

基础用法

通过 items 传入字段数组,每项包含 labelcontent。默认按断点自适应列数(xs 1 列、sm 2 列、md 及以上 3 列)。

带边框

设置 bordered 展示边框样式,配合 title 标题与 #extra 插槽(位于标题右侧的操作区域)。

垂直布局

通过 layout="vertical" 让标签位于内容上方。

不同尺寸

通过 size 设置 smallmiddlelarge 三种尺寸。

跨列与响应式

单项通过 span 设置跨列数,'filled' 表示占满当前行剩余空间;column 支持传入按断点配置的对象实现响应式列数。

子组件用法

不传 items 时,可在默认插槽中使用 VbenDescriptionsItem 声明列表项,内容支持默认插槽或 #content 插槽自定义。

API

Descriptions Props

属性名描述类型默认值
items数据驱动的列表项;不传则读取默认插槽DescriptionsItemType[]-
bordered是否展示边框booleanfalse
column一行的列数,支持按断点配置number | Partial<Record<Breakpoint, number>>{ xs: 1, sm: 2, md: 3, xxxl: 4 }
layout布局方式'horizontal' | 'vertical''horizontal'
size尺寸'small' | 'middle' | 'large''middle'
colon是否显示冒号(仅非边框的水平布局生效)booleantrue
title标题string-
extra标题右侧的操作区域string-
labelStyle统一的标签样式CSSProperties-
contentStyle统一的内容样式CSSProperties-
class根节点自定义类名string-

Descriptions Slots

插槽名描述
title自定义标题
extra自定义标题右侧操作区域
default放置 VbenDescriptionsItem 子组件

DescriptionsItem

items 数组中的每一项,或子组件 VbenDescriptionsItem 的属性。

属性名描述类型默认值
label标签string | number | (() => VNode) | Component-
content内容string | number | (() => VNode) | Component-
span跨列数,'filled' 占满当前行剩余number | 'filled' | Partial<Record<Breakpoint, number>>1
labelStyle标签样式CSSProperties-
contentStyle内容样式CSSProperties-
key唯一标识string | number-

DescriptionsItem Slots

仅子组件用法可用。

插槽名描述
default内容(等价于 content
content自定义内容
label自定义标签

Breakpoint

响应式断点 Breakpoint 取值为 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl',断点像素与 Ant Design 一致(sm 576、md 768、lg 992、xl 1200、xxl 1600、xxxl 2000)。:::

贡献者

页面历史

基于 MIT 许可发布.