Cell 单元格
单元格一般用于一组列表的情况,比如个人中心页,设置页等。本组件需配合c-cell-group组件一起使用并可统一配置样式。
平台
| App | 小程序 | H5 |
|---|---|---|
| √ | √ | √ |
属性
| 属性名 | 类型 | 默认值 | 说明 | 平台 |
|---|---|---|---|---|
| name | String | null | 名称,用于事件的标识 | All |
| icon | String,Object | null | label前的icon 为Object时,参考c-icon的props | All |
| label | String,Object | null | 左侧内容 | All |
| desc | String | null | 描述 | All |
| value | String,Object | null | 右侧内容 | All |
| placeholder | String,Object | null | value值为空时显示 | All |
| rightIcon | Boolean,String,Object | false | 右侧的icon,默认为右箭头 为Object时,参考c-icon的props | All |
| route | String,Object,Array | null | 路由跳转 参考uni.$c.route()参数 | All |
| hover | Boolean | true | 点击高亮反馈 | All |
| border | Boolean,Object | true | 是否显示下边框 为object时参考c-divider组件的Props | All |
| labelProps | Object | {} | label样式 参考c-text的props | All |
| valueProps | Object | {} | 右侧内容样式 参考c-text的props | All |
| placeholderProps | Object | {} | 右侧内容样式 参考c-text的props | All |
| descProps | Object | {} | 描述配置,参考c-text的props | All |
| iconProps | Object | {} | icon的配置,参考c-icon的props | All |
| rightIconProps | Object | {} | icon的配置,参考c-icon的props | All |
| hoverClass | String | c-bg-lighter | 点击高亮颜色 | All |
| cClass | String,Array,Object | null | 组件类 | All |
| cStyle | String,Array,Object | null | 组件样式 | All |
| margin | String,Number,Array | null | 外边距 | All |
| padding | String,Number,Array | null | 内边距 | All |
| bgColor | String | null | 背景色,支持c-bg-开头的背景色类 | All |
事件
| 事件名 | 说明 | 平台 |
|---|---|---|
| click | 单元格点击,如果配置了route属性将不触发 | All |
插槽
| 插槽名 | 说明 | 平台 |
|---|---|---|
| icon | icon插槽 | All |
| label | label后面的插槽 | All |
| desc | 描述插槽 | All |
| right | 右侧插槽 | All |
| default | All |
示例
vue
<template>
<c-cell-group title="标题" @click="onCellClick">
<c-cell name="1" label="单元格1" value="内容" />
<c-cell name="2" label="单元格2" rightIcon />
</c-cell-group>
</template>
<script setup>
function onCellClick(name) {
console.log('点击了', name)
}
</script>1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
