m-card 卡片容器
简述
卡片容器,用于包裹内容,提供边框、圆角、阴影。
注意
请以 uni_modules/m-unix 与本文为准;各端差异以 uni-app 与各平台官方文档为准。涉及隐私能力(相册、定位、剪贴板、手机号等)需在 manifest 与后台完成配置。
平台差异说明
| App(vue) | App(nvue) | H5 | 小程序 |
|---|---|---|---|
| √ | √ | √ | √ |
演示地址
与线上 H5 演示基座 分包一致(文档站右下角预览 iframe 亦指向同一路径)。
| 类型 | 地址 |
|---|---|
| 分包路径 | pages_demo/card/card |
| 线上 H5(hash) | 打开演示 |
基本使用
uvue
<template>
<m-card>
<view>
<text>卡片内容</text>
</view>
</m-card>
</template>Props
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
title | 顶部标题;空则不显示标题区 | string | '' |
subtitle | 副标题(标题下方) | string | '' |
thumb | 左侧/顶部缩略图 URL(非空则与标题并排或上图下文,见演示) | string | '' |
border | 是否显示边框 | boolean | true |
bordered | 与 border 同义,兼容旧用法;任一为 false 则不显示边框 | boolean | true |
shadow | 是否显示阴影 | boolean | false |
full | 是否通栏(左右无外边距) | boolean | false |
customStyle | 合并到根节点样式 | object | {} |
插槽
| 名称 | 说明 |
|---|---|
default | 卡片主体内容 |
footer | 底部区域(有插槽内容时显示底栏) |
示例
基础卡片
uvue
<m-card>
<view>
<text>这是卡片内容</text>
</view>
</m-card>阴影卡片
uvue
<m-card :shadow="true">
<view>
<text>带阴影的卡片</text>
</view>
</m-card>