Skip to content
On this page

组件库文档 tmui.design

卡片 Card

卡片风格。


🌶️ 卡片 Card 示例效果

查看模拟效果
示例代码
vue
<template>
    <tm-app>
        <tm-sheet>
            <tm-text :font-size="24" _class="font-weight-b" label="卡片可以完全通过插槽自定义"></tm-text>
        </tm-sheet>
        <tm-card status="2022-5-2" title="卡片标题" content="这是一个基础卡片示例,非常简单且实用。这是一个基础卡片示例,非常简单且实用。">
            <template v-slot:action>
                <view class="flex flex-row flex-row-center-end flex-1">
                    <tm-button :round="24" :margin="[24,0]" label="确认" :font-size="24" :width="120" :height="64"></tm-button>
                    <tm-button :round="24" color="white" label="取消"  :font-size="24" :width="120" :height="64"></tm-button>
                </view>
            </template>
        </tm-card>
        <tm-card status="2022-5-2" title="卡片标题" content="这是一个基础卡片示例,非常简单且实用。这是一个基础卡片示例,非常简单且实用。"></tm-card>
        <tm-card :border="1" statusColor="red" status="2022-5-2" title="看到边线卡片标题了吗?" content="这是一个基础卡片示例,非常简单且实用。这是一个基础卡片示例,非常简单且实用。"></tm-card>
        <tm-card status="2022-5-2" title="卡片标题" content="这是一个基础卡片示例,非常简单且实用。这是一个基础卡片示例,非常简单且实用。">
            <template v-slot:action>
                <view class="flex flex-row flex-row-center-end flex-1">
                    <tm-button :round="24" color="red" :margin="[24,0]" label="确认" :font-size="24" :width="120" :height="64"></tm-button>
                    <tm-button :round="24" color="white" label="取消"  :font-size="24" :width="120" :height="64"></tm-button>
                </view>
            </template>
        </tm-card>
    </tm-app>
</template>
<script lang="ts" setup>
import { ref } from "vue"
import { onShow, onLoad } from "@dcloudio/uni-app";
import tmApp from "@/tmui/components/tm-app/tm-app.vue"
import tmSheet from "@/tmui/components/tm-sheet/tm-sheet.vue"
import tmText from "@/tmui/components/tm-text/tm-text.vue"
import tmCard from "@/tmui/components/tm-card/tm-card.vue"
import tmButton from "@/tmui/components/tm-button/tm-button.vue"



</script>

🌶️ 兼容性

APP-VUEAPP-NVUE小程序WEB/H5VUE3/TS
✔️✔️✔️✔️✔️

🌱 参数

本组件含有公共属性 公共属性

参数名类型默认值描述
shadowNumber, String2卡片投影,0-26
roundNumber, String4卡片圆角,0-26
borderNumber0边框
marginArray[32, 0,32,24]外间距[x,y]x=左右,y=上下,详细规则见公共属性中的说明
paddingArray[16, 0]内间距[x,y]x=左右,y=上下
transprentBoolean,Stringfalse
colorStringwhite背景主题颜色名称
widthNumber0宽度,单位rpx
heightNumber0高度,单位rpx
titleString标题。
statusString状态文本
statusColorStringprimary状态文件的主题色
contentString卡片的正方内容

🌹 事件

🌽 slot插槽

插槽名数据类型描述
title--卡片标题
status--卡片右上角状态文本
content--卡片正文部分
action--卡片底部操作部分,默认为空

🥗 ref方法

💏 文档贡献

此页文档由﹎wj潕钶取玳贡献,如果对该框架感兴趣的可以参与我们一同进步!