For AI agents: the complete documentation index is available at https://docs.halo.run/llms.txt, the full documentation bundle is available at https://docs.halo.run/llms-full.txt, and this page is available as Markdown at https://docs.halo.run/developer-guide/plugin/api-reference/ui/base-components/description.md.

VDescription 描述列表

描述列表用于以“标签 - 内容”的形式展示对象的详细信息,常用于详情页和侧边信息面板。

引入

import { VDescription, VDescriptionItem } from "@halo-dev/components";

示例

基础用法

<script lang="ts" setup>
import { VDescription, VDescriptionItem } from "@halo-dev/components";
</script>

<template>
  <div class="rounded-base ring-1 ring-gray-100">
    <VDescription>
      <VDescriptionItem label="名称" content="Halo" />
      <VDescriptionItem label="版本" content="2.27.0" />
      <VDescriptionItem label="运行状态" content="正常" />
    </VDescription>
  </div>
</template>

自定义内容

VDescriptionItem 的默认插槽优先级高于 content 属性,可以在内容中放置标签、链接等富文本。

<script lang="ts" setup>
import { VDescription, VDescriptionItem, VTag } from "@halo-dev/components";
</script>

<template>
  <div class="rounded-base ring-1 ring-gray-100">
    <VDescription>
      <VDescriptionItem label="插件状态">
        <VTag theme="primary">已启用</VTag>
      </VDescriptionItem>
      <VDescriptionItem label="开发者">
        <a class="text-primary" href="https://www.halo.run" target="_blank">
          Halo 团队
        </a>
      </VDescriptionItem>
    </VDescription>
  </div>
</template>

垂直居中

<script lang="ts" setup>
import { VDescription, VDescriptionItem } from "@halo-dev/components";
</script>

<template>
  <div class="rounded-base ring-1 ring-gray-100">
    <VDescription>
      <VDescriptionItem label="描述" vertical-center>
        当内容较长时,标签与内容垂直居中显示。
      </VDescriptionItem>
    </VDescription>
  </div>
</template>

VDescription Props

VDescription 没有属性,只提供默认插槽。

VDescriptionItem Props

属性类型默认值说明
labelstring-标签文本,必填
contentstringundefined内容文本
verticalCenterbooleanfalse是否让标签和内容垂直居中

Slots

组件插槽说明
VDescriptiondefault描述项列表
VDescriptionItemdefault自定义内容,优先于 content