Skip to content

Commit

Permalink
docs(components): [collapse] use new display tag (#14955)
Browse files Browse the repository at this point in the history
docs(components): [collapse] use new display tag
  • Loading branch information
wzc520pyfm committed Dec 26, 2023
1 parent 34effd4 commit 3fdab26
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
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 @@ -17,7 +17,13 @@ export const emitChangeFn = (value: CollapseModelValue) =>
isNumber(value) || isString(value) || 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

0 comments on commit 3fdab26

Please sign in to comment.