Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(components): [collapse] use new display tag #14955

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions docs/en-US/component/collapse.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ collapse/customization

### Collapse Attributes

| Name | Description | Type | Default |
| --------------------- | ---------------------------------- | ---------------------------------------------------------- | ------- |
| model-value / v-model | currently active panel | ^[string] (accordion mode) / ^[array] (non-accordion mode) | |
| accordion | whether to activate accordion mode | ^[boolean] | false |
| Name | Description | Type | Default |
| --------------------- | --------------------------------------------------------------------------------------- | -------------------- | ------- |
| model-value / v-model | currently active panel, the type is `string` in accordion mode, otherwise it is `array` | ^[string] / ^[array] | [] |
| accordion | whether to activate accordion mode | ^[boolean] | false |

### Collapse Events

| Name | Description | Parameters |
| ------ | ---------------------------------- | --------------------------------------------------------------------- |
| change | triggers when active panels change | `(activeNames: array (non-accordion mode) / string (accordion mode))` |
| Name | Description | Type |
| ------ | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| change | triggers when active panels change, the parameter type is `string` in accordion mode, otherwise it is `array` | ^[Function]`(activeNames: array \| string) => void` |

### Collapse Slots

Expand All @@ -62,11 +62,11 @@ collapse/customization

### Collapse Item Attributes

| Name | Description | Type | Default |
| -------- | ---------------------------------- | ------------------- | ------- |
| name | unique identification of the panel | ^[string]/^[number] ||
| title | title of the panel | ^[string] | |
| disabled | disable the collapse item | ^[boolean] | |
| Name | Description | Type | Default |
| -------- | ---------------------------------- | --------------------- | ------- |
| name | unique identification of the panel | ^[string] / ^[number] ||
| title | title of the panel | ^[string] | '' |
| disabled | disable the collapse item | ^[boolean] | false |

### Collapse Item Slot

Expand Down
9 changes: 9 additions & 0 deletions packages/components/collapse/src/collapse-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ import type { ExtractPropTypes } from 'vue'
import type { CollapseActiveName } from './collapse'

export const collapseItemProps = buildProps({
/**
* @description title of the panel
*/
title: {
type: String,
default: '',
},
/**
* @description unique identification of the panel
*/
name: {
type: definePropType<CollapseActiveName>([String, Number]),
default: () => generateId(),
},
/**
* @description disable the collapse item
*/
disabled: Boolean,
} as const)
export type CollapseItemProps = ExtractPropTypes<typeof collapseItemProps>
6 changes: 6 additions & 0 deletions packages/components/collapse/src/collapse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ export const emitChangeFn = (value: CollapseModelValue) =>
typeof isNumber(value) || isString(value) || Array.isArray(value)

export const collapseProps = buildProps({
/**
* @description whether to activate accordion mode
*/
accordion: Boolean,
/**
* @description currently active panel, the type is `string` in accordion mode, otherwise it is `array`
*/
modelValue: {
type: definePropType<CollapseModelValue>([Array, String, Number]),
default: () => mutable([] as const),
Expand Down
Loading