CollapseItem
Keeps the header interactive and optionally mounts content only after its first expansion.
Import
Use <hui-collapse-item> after configuring uni-app easycom. Import public types and functions from @nscode/handy-uni. Ordinary Vue applications install the @nscode/handy-uni/web preview plugin.
Examples
Each example is standalone. Controls show the current value or event result on the page.
<template>
<view>
<hui-collapse>
<hui-collapse-item name="first" title="标题 / Title" label="补充 / Supporting" icon="info"
>首次展开才挂载 / Mounted on first expansion</hui-collapse-item
>
<hui-collapse-item name="second" title="只读 / Readonly" readonly :lazy-render="false"
>提前渲染 / Eager content</hui-collapse-item
>
</hui-collapse>
</view>
</template>
Props
| Prop | Type | Default | Details |
|---|---|---|---|
name | CollapseName | — | Unique item identity. |
title | string | — | Heading text, or the title-placeholder switch for Skeleton. |
label | string | — | Accessible name or text label. |
value | string | number | — | Absolute deadline as a timestamp or Date; takes priority over time. |
icon | string | — | Icon registry name. |
disabled | boolean | false | Disables user interaction. |
readonly | boolean | false | Leaves display enabled while blocking state changes. |
lazyRender | boolean | true | Mounts content only when first expanded and retains it afterward. |
Root classes and styles use customClass and customStyle. Numbers representing dimensions use px; durations use ms unless explicitly documented.
Events
None.
Slots
| Slot | Scope |
|---|---|
icon | — |
title | { expanded } |
value | — |
right-icon | { expanded } |
default | — |
Methods
| Method | Signature | Description |
|---|---|---|
toggle | (expanded?: boolean): void | Request expansion change. |
Types
CollapseItemProps、CollapseItemEmits、CollapseItemExpose.
Platform notes
Supports H5, WeChat mini-program, App-vue and ordinary Vue 3 Web through shared platform components. Unit tests do not replace device acceptance; verify touch, screen readers, deactivation and native rendering on each target.
Device smoke checklist.