Cell
组件类型:UxCellComponentPublicInstance
支持配置标题、描述文本、内容及样式,左右图标、插槽,最小高度、固定高度,对齐方式
平台兼容性
UniApp X
Android | iOS | web | 鸿蒙 Next | 小程序 |
---|---|---|---|---|
√ | √ | √ | x | √ |
UniApp Vue Nvue
Android | iOS | web | 鸿蒙 Next | 小程序 |
---|---|---|---|---|
x | x | √ | x | x |
Props
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
left | Slot | 左边插槽 | |
right | Slot | 右边插槽 | |
title | String | 标题 | |
size | Any | 14 | 标题大小 |
color | String | $ux.Conf.fontColor | 标题颜色 |
darkColor | String | 深色none-不显示,auto-自动适配深色模式,其他-颜色 | |
bold | Boolean | false | 标题加粗 |
titleStyle | String | 标题样式 | |
summary | String | 描述文本 | |
summaryColor | String | $ux.Conf.subtitleColor | 描述文本颜色 |
summarySize | Any | $ux.Conf.fontSize.small | 描述文本大小 |
summaryStyle | String | 描述文本样式 | |
label | String | 右侧内容 | |
labelSize | Any | $ux.Conf.fontSize | 内容大小 |
labelColor | String | $ux.Conf.subtitleColor | 内容颜色 |
labelBold | Boolean | false | 内容加粗 |
labelStyle | String | 内容样式 | |
placeholder | String | 右侧占位内容 | |
placeholderSize | Any | $ux.Conf.fontSize.small | 右侧占位内容大小 |
placeholderColor | String | $ux.Conf.placeholderColor | 右侧占位内容颜色 |
placeholderDark | String | 深色none-不显示,auto-自动适配深色模式,其他-颜色 | |
placeholderStyle | String | 内容样式 | |
icon | String | 标题图标 | |
iconColor | String | $ux.Conf.fontColor | 标题图标颜色 |
iconSize | Any | $ux.Conf.fontSize | 标题图标大小 |
iconStyle | String | 标题图标样式 | |
rightIcon | String | 右侧图标 | |
rightArrow | Boolean | true | 右侧箭头图标 |
rightIconStyle | String | 右侧图标样式 | |
customFont | String | 自定义字体路径 | |
customFamily | String | 字体family | |
background | String | 背景色 | |
backgroundDark | String | auto | 深色none-不显示,auto-自动适配深色模式,其他-颜色 |
border | Boolean | true | 显示下边框 |
borderColor | String | $ux.Conf.borderColor | 下边框颜色 |
borderDarkColor | String | auto | 深色none-不显示,auto-自动适配深色模式,其他-颜色 |
minHeight | Any | 0 | 最小高度 |
height | Any | 40 | 固定高度优先级高于最小高度 |
padding | Any | $ux.Conf.rowPadding | 内部水平边距 |
center | Boolean | false | 内容是否垂直居中 |
required | Boolean | false | 是否显示必填星号 |
path | String | 页面跳转路径 | |
show | String | true | 是否显示cell |
disabled | Boolean | false | 是否禁用cell |
hover | Boolean | true | 显示点击态 |
margin | Array | 边距[上右下左][上下左右][上下左右] | |
mt | Any | 距上单位px | |
mr | Any | 距右单位px | |
mb | Any | 距下单位px | |
ml | Any | 距左单位px | |
xstyle | Array | 自定义样式 |
darkColor
值 | 说明 |
---|---|
none不显示 | |
auto自动适配深色模式 | |
color其他颜色 |
placeholderDark
值 | 说明 |
---|---|
none不显示 | |
auto自动适配深色模式 | |
color其他颜色 |
backgroundDark
值 | 说明 |
---|---|
none不显示 | |
auto自动适配深色模式 | |
color其他颜色 |
borderDarkColor
值 | 说明 |
---|---|
none不显示 | |
auto自动适配深色模式 | |
color其他颜色 |
Events
事件名 | 说明 | 参数 |
---|---|---|
click | 单元格点击时触发 |
示例代码
html
<template>
<ux-page :stack="showDoc">
<ux-navbar :title="title" :bold="true">
<template v-slot:right>
<!-- #ifndef MP -->
<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
<!-- #endif -->
</template>
</ux-navbar>
<ux-scroll>
<ux-card direction="column" icon="flag-filled" title="单元格" :bold="true">
<ux-text text="支持配置标题、描述文本、内容及样式,左右图标、插槽,最小高度、固定高度,对齐方式"></ux-text>
</ux-card>
<ux-card direction="column" icon="arrowright" title="标题内容" :bold="true">
<ux-text text="支持配置标题、描述文本、内容及样式" :mb="15"></ux-text>
<ux-col>
<ux-cell title="UxFrmae" label="ui 框架" :required="true"></ux-cell>
<ux-cell title="让UniX开发更简单" summary="高性能UI框架" label="Lets Go" :right-arrow="false" :height="60"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="左右图标" :bold="true">
<ux-text text="左右图标支持icon和图片" :mb="15"></ux-text>
<ux-col>
<ux-cell title="图标" icon="signature" color="blue" icon-color="blue"></ux-cell>
<ux-cell title="照片" icon="/static/logo.png"></ux-cell>
<ux-cell title="下箭头" right-icon="arrowdown" :border="false"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="高度" :bold="true">
<ux-text text="支持配置最小高度和固定高度" :mb="15"></ux-text>
<ux-col>
<ux-cell title="最小高度" :right-arrow="true" :min-height="30"></ux-cell>
<ux-cell title="固定高度" :right-arrow="true" :height="80"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="内容居中" :bold="true">
<ux-text text="支持标题居中显示" :mb="15"></ux-text>
<ux-col>
<ux-cell icon="setoff-filled" icon-color="red" title="退出账号" color="red" :center="true" :border="false" :right-arrow="false"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="左右边距" :bold="true">
<ux-text text="支持配置左右边距" :mb="15"></ux-text>
<ux-col>
<ux-cell title="左右0边距"></ux-cell>
<ux-cell title="左右30边距" :padding="30"></ux-cell>
<ux-cell title="默认边距" :border="false"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="自定义插槽" :bold="true">
<ux-text text="支持左右插槽、summary插槽" :mb="15"></ux-text>
<ux-col>
<ux-cell label="左侧插槽">
<template v-slot:left>
<ux-image :width="25" mode="widthFix" src="/static/logo.png"></ux-image>
</template>
</ux-cell>
<ux-cell title="右侧插槽">
<template v-slot:right>
<ux-row justify="right">
<ux-badge :value="88" :fixed="false" :right="10"></ux-badge>
<ux-icon type="scan-outline"></ux-icon>
</ux-row>
</template>
</ux-cell>
<ux-cell title="summary插槽">
<template v-slot:summary>
<ux-text text="我是插槽" theme="success"></ux-text>
</template>
</ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="跳转页面" :bold="true">
<ux-text text="支持点击直接跳转页面" :mb="15"></ux-text>
<ux-col>
<ux-cell title="跳转到Button" path="/pages/component/button?title=From Cell单元格" :border="false"></ux-cell>
</ux-col>
</ux-card>
<ux-placeholder :height="200">
<ux-row justify="center" align="center" style="height: 100%;">
<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
</ux-row>
</ux-placeholder>
</ux-scroll>
</ux-page>
</template>
<template>
<ux-page :stack="showDoc">
<ux-navbar :title="title" :bold="true">
<template v-slot:right>
<!-- #ifndef MP -->
<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
<!-- #endif -->
</template>
</ux-navbar>
<ux-scroll>
<ux-card direction="column" icon="flag-filled" title="单元格" :bold="true">
<ux-text text="支持配置标题、描述文本、内容及样式,左右图标、插槽,最小高度、固定高度,对齐方式"></ux-text>
</ux-card>
<ux-card direction="column" icon="arrowright" title="标题内容" :bold="true">
<ux-text text="支持配置标题、描述文本、内容及样式" :mb="15"></ux-text>
<ux-col>
<ux-cell title="UxFrmae" label="ui 框架" :required="true"></ux-cell>
<ux-cell title="让UniX开发更简单" summary="高性能UI框架" label="Lets Go" :right-arrow="false" :height="60"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="左右图标" :bold="true">
<ux-text text="左右图标支持icon和图片" :mb="15"></ux-text>
<ux-col>
<ux-cell title="图标" icon="signature" color="blue" icon-color="blue"></ux-cell>
<ux-cell title="照片" icon="/static/logo.png"></ux-cell>
<ux-cell title="下箭头" right-icon="arrowdown" :border="false"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="高度" :bold="true">
<ux-text text="支持配置最小高度和固定高度" :mb="15"></ux-text>
<ux-col>
<ux-cell title="最小高度" :right-arrow="true" :min-height="30"></ux-cell>
<ux-cell title="固定高度" :right-arrow="true" :height="80"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="内容居中" :bold="true">
<ux-text text="支持标题居中显示" :mb="15"></ux-text>
<ux-col>
<ux-cell icon="setoff-filled" icon-color="red" title="退出账号" color="red" :center="true" :border="false" :right-arrow="false"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="左右边距" :bold="true">
<ux-text text="支持配置左右边距" :mb="15"></ux-text>
<ux-col>
<ux-cell title="左右0边距"></ux-cell>
<ux-cell title="左右30边距" :padding="30"></ux-cell>
<ux-cell title="默认边距" :border="false"></ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="自定义插槽" :bold="true">
<ux-text text="支持左右插槽、summary插槽" :mb="15"></ux-text>
<ux-col>
<ux-cell label="左侧插槽">
<template v-slot:left>
<ux-image :width="25" mode="widthFix" src="/static/logo.png"></ux-image>
</template>
</ux-cell>
<ux-cell title="右侧插槽">
<template v-slot:right>
<ux-row justify="right">
<ux-badge :value="88" :fixed="false" :right="10"></ux-badge>
<ux-icon type="scan-outline"></ux-icon>
</ux-row>
</template>
</ux-cell>
<ux-cell title="summary插槽">
<template v-slot:summary>
<ux-text text="我是插槽" theme="success"></ux-text>
</template>
</ux-cell>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="跳转页面" :bold="true">
<ux-text text="支持点击直接跳转页面" :mb="15"></ux-text>
<ux-col>
<ux-cell title="跳转到Button" path="/pages/component/button?title=From Cell单元格" :border="false"></ux-cell>
</ux-col>
</ux-card>
<ux-placeholder :height="200">
<ux-row justify="center" align="center" style="height: 100%;">
<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
</ux-row>
</ux-placeholder>
</ux-scroll>
</ux-page>
</template>
ts
<script setup>
import * as plus from '@/uni_modules/ux-plus'
import { useBackgroundColor } from '@/uni_modules/ux-frame'
const title = ref('')
const backgroundColor = computed((): string => {
return useBackgroundColor('#f0f0f0', '#555555')
})
const style = computed((): string => {
return `background-color: ${backgroundColor.value}`
})
const showDoc = ref(false)
function onDoc() {
plus.openWeb({
title: '在线文档',
url: 'https://www.uxframe.cn/component/cell.html',
// blur: 1,
success: () => {
showDoc.value = true
},
complete: () => {
showDoc.value = false
}
})
}
onLoad((e) => {
title.value = e['title'] ?? ''
})
</script>
<script setup>
import * as plus from '@/uni_modules/ux-plus'
import { useBackgroundColor } from '@/uni_modules/ux-frame'
const title = ref('')
const backgroundColor = computed((): string => {
return useBackgroundColor('#f0f0f0', '#555555')
})
const style = computed((): string => {
return `background-color: ${backgroundColor.value}`
})
const showDoc = ref(false)
function onDoc() {
plus.openWeb({
title: '在线文档',
url: 'https://www.uxframe.cn/component/cell.html',
// blur: 1,
success: () => {
showDoc.value = true
},
complete: () => {
showDoc.value = false
}
})
}
onLoad((e) => {
title.value = e['title'] ?? ''
})
</script>
css
<style lang="scss">
.title {
width: 100%;
height: 80rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
</style>
<style lang="scss">
.title {
width: 100%;
height: 80rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
</style>