干巴爹兔的博客 干巴爹兔的博客
首页
  • 前端文章

    • JavaScript
    • HTML
    • Vue
  • 学习笔记

    • JavaScript教程
    • React学习笔记
    • Electron学习笔记
  • 开源项目

    • cloud-app-admin
    • 下班了吗Vscode插件
    • Subversion变更单插件
  • Server

    • Django
  • 学习笔记

    • MySQL学习笔记
  • 运维

    • 服务器部署
    • Linux
  • 日常学习

    • 学习方法
关于
收藏
友链
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

干巴爹兔

卑微的前端打工人
首页
  • 前端文章

    • JavaScript
    • HTML
    • Vue
  • 学习笔记

    • JavaScript教程
    • React学习笔记
    • Electron学习笔记
  • 开源项目

    • cloud-app-admin
    • 下班了吗Vscode插件
    • Subversion变更单插件
  • Server

    • Django
  • 学习笔记

    • MySQL学习笔记
  • 运维

    • 服务器部署
    • Linux
  • 日常学习

    • 学习方法
关于
收藏
友链
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • JavaScript文章

  • 学习笔记

  • 开源项目

    • cloud-app-admin
    • could-app-admin前端组件

      • AsyncSelect异步加载下拉组件
      • Card卡片组件
        • 引入组件
        • 参数配置
        • 代码示例
          • empty效果
          • auto-height、插槽效果
          • err-capture、插槽效果
      • Panel展示组件
      • CForm表单组件
      • SearchFilter组件
      • CTable表格组件
    • 下班了吗Vscode插件

    • Subversion变更单插件

  • HTML

  • Vue

  • 前端
  • 开源项目
  • could-app-admin前端组件
干巴爹兔
2022-08-31
目录

Card卡片组件

# 引入组件

import { App } from "vue";
import Card from "./Card.vue";

export function setupRegisterGlobComp(app: App) {
  app.component("Card", Card);
}
1
2
3
4
5
6

# 参数配置

额外参数 类型 必填 说明
empty Boolean 非必填 是否展示header部分,为true默认展示空白卡片
autoHeight Boolean 非必填 高度自适应,false为默认330px高度
errCapture Boolean 非必填 展示错误结果,为true展示error报错信息
slot [ name = title ] Slot 非必填 卡片标题占位插槽
slot [ name = actions ] Slot 非必填 卡片右上角占位插槽
slot [ name = content ] Slot 非必填 卡片内容部分占位插槽
slot [ name = error ] Slot 非必填 卡片报错信息提示占位插槽

# 代码示例

# empty效果

<script setup lang="ts"></script>

<template>
  <Card empty />
</template>

<style scoped></style>
1
2
3
4
5
6
7

card-example1

# auto-height、插槽效果

<script setup lang="ts"></script>

<template>
  <Card empty auto-height>
    <template #title>
      <p class="truncate">标题</p>
    </template>
    <template #actions>
      <p class="truncate">操作栏</p>
    </template>
    <template #content>
      <div class="p-5 h-[200px]">内容</div>
    </template>
  </Card>
</template>

<style scoped></style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

card-example2

# err-capture、插槽效果

<script setup lang="ts"></script>

<template>
  <Card empty auto-height err-capture>
    <template #title>
      <p class="truncate">标题</p>
    </template>
    <template #actions>
      <p class="truncate">操作栏</p>
    </template>
    <template #error>
      <div class="flex justify-center items-center h-[220px] w-8/12 text-center mx-auto">
        <p class="text-lg font-semibold text-gray-500">报错了</p>
      </div>
    </template>
  </Card>
</template>

<style scoped></style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

card-example3

编辑 (opens new window)
上次更新: 2022/09/08, 15:49:40
AsyncSelect异步加载下拉组件
Panel展示组件

← AsyncSelect异步加载下拉组件 Panel展示组件→

最近更新
01
使用Vscode开发一个小插件
10-21
02
Vscode插件配置项监听
10-18
03
使用has属性构造必填效果
10-14
更多文章>
Theme by Vdoing | Copyright © 2020-2023 互联网ICP备案: 闽ICP备18027236号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式