-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d894b2b
commit 0b56c10
Showing
3 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## Collapse Attributes | ||
|
||
| Name | 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 | ||
|
||
| Name | Description | Parameters | | ||
| ------ | ---------------------------------- | ------------------------------------------------------------------- | | ||
| change | triggers when active panels change | (activeNames: array (non-accordion mode) / string (accordion mode)) | | ||
|
||
## Collapse Slots | ||
|
||
| Name | Description | Subtags | | ||
| ---- | ------------------------- | ------------- | | ||
| - | customize default content | Collapse Item | | ||
|
||
## Collapse Item Attributes | ||
|
||
| Name | 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<script setup lang="ts"> | ||
import { isAttribute } from '@/utils' | ||
const activeNames = ref(['1']) | ||
const accordion = ref(false) | ||
const firstCollapseItem = reactive({ | ||
title: 'Consistency', | ||
disabled: false, | ||
}) | ||
const secondCollapseItem = reactive({ | ||
title: 'Feedback', | ||
disabled: false, | ||
}) | ||
const source = computed(() => { | ||
return `<script setup lang="ts"> | ||
const activeNames = ref(['1']) | ||
<\/script> | ||
<template> | ||
<el-collapse v-model="activeNames"> | ||
<el-collapse-item | ||
title="${firstCollapseItem.title}" | ||
name="1"${ | ||
isAttribute( | ||
firstCollapseItem.disabled, | ||
' disabled', | ||
)} | ||
> | ||
Consistent with real life: in line with the process and logic of real | ||
life, and comply with languages and habits that the users are used to; | ||
</el-collapse-item> | ||
<el-collapse-item | ||
title="${firstCollapseItem.title}" | ||
name="2"${ | ||
isAttribute( | ||
firstCollapseItem.disabled, | ||
' disabled', | ||
)} | ||
> | ||
Operation feedback: enable the users to clearly perceive their | ||
operations by style updates and interactive effects; | ||
</el-collapse-item> | ||
</el-collapse> | ||
</template> | ||
` | ||
}) | ||
</script> | ||
|
||
<template> | ||
<Story title="Data/Collapse" icon="mdi:collapse-all"> | ||
<Variant | ||
title="Basic Usage" | ||
:source="source" | ||
> | ||
<el-collapse | ||
v-model="activeNames" | ||
:accordion="accordion" | ||
> | ||
<el-collapse-item | ||
:title="firstCollapseItem.title" | ||
:disabled="firstCollapseItem.disabled" | ||
name="1" | ||
> | ||
Consistent with real life: in line with the process and logic of real | ||
life, and comply with languages and habits that the users are used to; | ||
</el-collapse-item> | ||
<el-collapse-item | ||
:title="secondCollapseItem.title" | ||
:disabled="secondCollapseItem.disabled" | ||
name="2" | ||
> | ||
Operation feedback: enable the users to clearly perceive their | ||
operations by style updates and interactive effects; | ||
</el-collapse-item> | ||
</el-collapse> | ||
<template #controls> | ||
<HstCheckbox v-model="accordion" title="Accordion" /> | ||
<el-divider border-style="dotted" content-position="left"> | ||
<span>First Collapse Item</span> | ||
</el-divider> | ||
<HstText v-model="firstCollapseItem.title" title="Title" /> | ||
<HstCheckbox v-model="firstCollapseItem.disabled" title="Disable" /> | ||
<el-divider border-style="dotted" content-position="left"> | ||
<span>Second Collapse Item</span> | ||
</el-divider> | ||
<HstText v-model="secondCollapseItem.title" title="Title" /> | ||
<HstCheckbox v-model="secondCollapseItem.disabled" title="Disable" /> | ||
</template> | ||
</Variant> | ||
</Story> | ||
</template> |