Skip to content

基础卡片组件

基础卡片组件是一个通用的卡片容器,用于展示标题和内容,支持自定义头部工具和扩展内容。

组件说明

DuxStatsCard

基础卡片组件,支持标题、工具栏和扩展内容的展示。

属性

属性名类型默认值说明
titlestring-标题文本
headClassstring-头部样式类
contentClassstring-内容样式类

插槽

名称说明
tools工具栏内容
extend扩展内容
default主要内容

代码示例

基础用法

vue
<template>
  <dux-stats-card title="基础卡片">
    <div>这是卡片内容</div>
  </dux-stats-card>
</template>

带工具栏

vue
<template>
  <dux-stats-card title="带工具栏的卡片">
    <template #tools>
      <n-button size="small">刷新</n-button>
    </template>
    <div>这是卡片内容</div>
  </dux-stats-card>
</template>

完整示例

vue
<template>
  <dux-stats-card title="完整示例" head-class="!py-6" content-class="!p-6">
    <template #tools>
      <n-button-group>
        <n-button size="small">编辑</n-button>
        <n-button size="small">删除</n-button>
      </n-button-group>
    </template>
    <template #extend>
      <n-tag>标签</n-tag>
    </template>
    <div class="flex flex-col gap-4">
      <div>主要内容区域</div>
      <div>支持任意内容</div>
    </div>
  </dux-stats-card>
</template>