Skip to content
On this page

组件库文档 tmui.design

单元格 Cell

常用于列表


🌶️ 单元格 Cell 示例

查看模拟效果
示例模板
vue
<template>
    <tm-app >
        <tm-sheet>
            <tm-text :font-size="24" _class="font-weight-b" label="基础示例,更多见文档"></tm-text>
        </tm-sheet>
        <view class="mb-32 mx-32 round-3 overflow">
            <tm-cell :margin="[0, 0]" :titleFontSize="30" title="头像 Avatar"> </tm-cell>
            <tm-cell :margin="[0, 0]" :titleFontSize="30" title="徽标 Badge"> </tm-cell>
            <tm-cell :margin="[0, 0]" :titleFontSize="30" title="卡片 Card"> </tm-cell>
        </view>
        <view class="mb-32 mx-32 round-3 overflow">
            <tm-cell :round="3" :margin="[0, 0,0,16]" :titleFontSize="30" title="头像 Avatar"> </tm-cell>
            <tm-cell :round="3" :margin="[0, 0,0,16]" rightText="简单组件简单组件" :titleFontSize="30" title="徽标 Badge"> </tm-cell>
            <tm-cell :round="3" :margin="[0, 0,0,16]" rightColor="red" rightText="2个" :titleFontSize="30" title="卡片 Card"> </tm-cell>
        </view>
        <view class="mb-32 mx-32 round-3 overflow">
            <tm-cell bottomBorder :margin="[0, 0]" :titleFontSize="30" title="头像 Avatar"> </tm-cell>
            <tm-cell bottomBorder :margin="[0, 0]" :titleFontSize="30" title="徽标 Badge"> </tm-cell>
            <tm-cell :margin="[0, 0]" :titleFontSize="30" title="卡片 Card"> </tm-cell>
        </view>
        <view class="mb-32 mx-32 round-3 overflow">
            <tm-cell showAvatar avatar="https://picsum.photos/200" rightText="简单组件简单组件"  :margin="[0, 0]" :titleFontSize="30" title="头像 Avatar"> </tm-cell>
            <tm-cell  :margin="[0, 0]" :titleFontSize="30" title="徽标 Badge">
                <template v-slot:right>
                    <tm-checkbox :round="12"></tm-checkbox>
                </template>
            </tm-cell>
            <tm-cell :margin="[0, 0]" :titleFontSize="30" title="卡片 Card"> </tm-cell>
        </view>
    </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 tmCheckbox from "@/tmui/components/tm-checkbox/tm-checkbox.vue"
import tmCell from "@/tmui/components/tm-cell/tm-cell.vue"
</script>

🌶️ 兼容性

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

🌱 参数

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

参数名类型默认值描述
shadow[Number,String]0投影,0-25
round[Number,String]0圆角0-25,单位rpx
marginArray()=>[32,0]外间距[x,y]x=左右,y=上下
paddingArray()=>[24,24]内间距[x,y]x=左右,y=上下
height[Number]0高度,单位rpx
transprent[Boolean,String]false是否透明
colorString"white"单元格背景色
titleString"",标题
titleColorString"",默认为空,采用自动配色(根据主题)
titleFontSize[Number,String]28标题字体大小
labelString""标题下方的描述
labelColorString"grey"标题下方文字的颜色
labelFontSizeNumber22标题下方文字的的大小
rightTextString""右边文字
rightTextSizev3.0.75+Number24右边文字大小
rightIconString"tmicon-angle-right"右图标名称,可以是图片地址
rightColorString"grey"右边文字颜色
showAvatarBooleanfalse是否显示头像
avatarString""头像路径
avatarSizeNumber60头像大小
avatarRoundNumber10头像圆角
border[Number]0边线宽度
borderDirection[String as cssDirection ]bottom边线方向
bottomBorder[Boolean]false是否显示下边线
urlString""当有链接地址时,将打开链接
darkBgColorString''有时自动的背景,可能不是你想要暗黑背景,此时可以使用此参数,强制使用背景色

🌹 事件

事件名参数返回数据描述
@click点击组件时触发。

🌽 slot插槽

插槽名称类型数据说明
avatar自定义头像
title自定义左侧标题部分的内容
label自定义label内容
rightText自定义右边文字内容
right自定义右图标内容

🥗 ref方法

贡献者

Mr.童