Cell Cell
Present a title, description, value and optional navigation action.
Import
Use <hui-cell> with uni-app easycom. Import public types from @nscode/handy-uni. For ordinary Vue 3, install the preview plugin from @nscode/handy-uni/web and register its components.
Examples
Interact with the controls to see values and event results on the page.
vue
<template>
<view>
<hui-cell
title="通知 / Notifications"
label="点击记录事件 / Tap to record"
value="已开启 / On"
icon="bell"
is-link
clickable
@click="event0"
/>
<hui-cell-group title="账户 / Account" inset
><hui-cell title="名称 / Name" value="Guest" /><hui-cell title="自定义 / Custom"
><template #value><hui-tag type="success">已认证 / Verified</hui-tag></template
><template #extra><text>额外内容 / Extra</text></template></hui-cell
></hui-cell-group
>
<text>{{ lastEvent }}</text>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const lastEvent = ref('No event yet')
const describe = (value: unknown) => {
try {
return JSON.stringify(value) ?? String(value)
} catch {
return String(value)
}
}
const event0 = (arg0: unknown) => {
lastEvent.value = 'click' + ': ' + [describe(arg0)].join(', ')
}
</script>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | — | Title. |
label | string | — | Visible label. |
value | string | number | — | Option value or displayed value. |
icon | string | — | Registered icon name. |
isLink | boolean | false | Show a navigation arrow. |
arrowDirection | CellArrowDirection | 'right' | Arrow direction. |
clickable | boolean | false | Enable pressed styling and keyboard activation. |
required | boolean | false | Required indication; derived from rules when omitted. |
center | boolean | false | Center cell content vertically. |
size | "large" | "default" | — | Component size; inherits configuration when omitted. |
border | boolean | undefined | Show the bottom separator by default; CellGroup clips the last separator. |
to | string | — | Target URL passed to the router adapter. |
replace | boolean | false | Replace the current navigation entry. |
Root attributes: common props. A Boolean default of undefined supports inheritance; explicit false overrides it. Other Boolean props default to false unless listed otherwise.
Events
| Event | Parameters | Description |
|---|---|---|
click | (event: unknown) | Emitted when the interactive area is clicked. |
Slots
| Slot | Parameters | Description |
|---|---|---|
icon | — | Custom icon region; replaces its fallback content. |
title | — | Custom title region; replaces its fallback content. |
label | — | Custom label region; replaces its fallback content. |
value | — | Custom value region; replaces its fallback content. |
default | — | Main content. |
right-icon | — | Custom right-icon region; replaces its fallback content. |
extra | — | Custom extra region; replaces its fallback content. |
Methods
None.
Types
CellProps、CellArrowDirection、CellEmits are available from @nscode/handy-uni.
ts
export type CellArrowDirection = 'right' | 'down' | 'up'
Platform notes
| Behavior | uni-app H5 | WeChat Mini Program | App-vue | Ordinary Vue 3 Web (preview) |
|---|---|---|---|---|
| Basic interaction | Supported; device checks pending | Supported; device checks pending | Supported; device checks pending | Supported by the web platform adapter |
Follow the smoke checklist. Device evidence is tracked separately; unit tests do not establish device acceptance.