2021-10-22 19:32:39 +08:00
|
|
|
---
|
2021-10-25 15:21:08 +08:00
|
|
|
title: Collapse
|
2021-10-22 19:32:39 +08:00
|
|
|
lang: en-US
|
|
|
|
---
|
|
|
|
|
2021-09-17 00:18:50 +08:00
|
|
|
# Collapse
|
|
|
|
|
|
|
|
Use Collapse to store contents.
|
|
|
|
|
|
|
|
## Basic usage
|
|
|
|
|
|
|
|
You can expand multiple panels
|
|
|
|
|
|
|
|
:::demo
|
|
|
|
|
|
|
|
collapse/basic
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
## Accordion
|
|
|
|
|
|
|
|
In accordion mode, only one panel can be expanded at once
|
|
|
|
|
|
|
|
:::demo Activate accordion mode using the `accordion` attribute.
|
|
|
|
|
|
|
|
collapse/accordion
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
## Custom title
|
|
|
|
|
|
|
|
Besides using the `title` attribute, you can customize panel title with named slots, which makes adding custom content, e.g. icons, possible.
|
|
|
|
|
|
|
|
:::demo
|
|
|
|
|
|
|
|
collapse/customization
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
## Collapse Attributes
|
|
|
|
|
|
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
|
|
| --------------------- | ---------------------------------- | ---------------------------------------------------- | --------------- | ------- |
|
|
|
|
| model-value / v-model | currently active panel | string (accordion mode) / array (non-accordion mode) | — | — |
|
|
|
|
| accordion | whether to activate accordion mode | boolean | — | false |
|
|
|
|
|
|
|
|
## Collapse Events
|
|
|
|
|
|
|
|
| Event Name | Description | Parameters |
|
|
|
|
| ---------- | ---------------------------------- | ------------------------------------------------------------------- |
|
|
|
|
| change | triggers when active panels change | (activeNames: array (non-accordion mode) / string (accordion mode)) |
|
|
|
|
|
2021-10-04 08:26:51 +08:00
|
|
|
## Collapse Slots
|
|
|
|
|
|
|
|
| Name | Description | Subtags |
|
|
|
|
| ---- | ------------------------- | ------------- |
|
|
|
|
| - | customize default content | Collapse Item |
|
|
|
|
|
2021-09-17 00:18:50 +08:00
|
|
|
## Collapse Item Attributes
|
|
|
|
|
|
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
|
|
| --------- | ---------------------------------- | ------------- | --------------- | ------- |
|
|
|
|
| name | unique identification of the panel | string/number | — | — |
|
|
|
|
| title | title of the panel | string | — | — |
|
|
|
|
| disabled | disable the collapse item | boolean | — | — |
|
|
|
|
|
|
|
|
## Collapse Item Slot
|
|
|
|
|
|
|
|
| Name | Description |
|
|
|
|
| ----- | ------------------------------ |
|
|
|
|
| — | content of Collapse Item |
|
|
|
|
| title | content of Collapse Item title |
|