Files
timi-web/docs/components/description-grid.md
2026-09-21 15:32:12 +08:00

32 lines
757 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# DescriptionGrid 描述栅格
键值对描述列表,可指定列数、对齐方式与逐项具名插槽。
## 基础用法
:::preview 基础用法 || value 为空的项显示 emptyText,bordered 控制是否描边
demo-preview=../demos/description-grid/basic.vue
:::
## 何时使用
详情页展示一组字段时使用。相比手写表格,它省掉了表头,并且窄屏可自动降为单列。
## 自定义某一项
每一项都可以通过具名插槽接管渲染,插槽名为 `label-<key>` 与 `value-<key>`:
```vue
<description-grid :items="items">
<template #value-status="{ item }">
<icon :name="item.value === 'ok' ? 'success' : 'fail'" />
</template>
</description-grid>
```
## API
<api-table name="DescriptionGrid" />