|
|
@@ -29,7 +29,7 @@ Control the expanded panel list through 'V-model', and 'activenames' is in array
|
|
|
|
|
|
```html
|
|
|
<template>
|
|
|
-<nut-collapse v-model:active="activeNames" icon="down-arrow">
|
|
|
+<nut-collapse v-model:active="activeNames">
|
|
|
<nut-collapse-item :name="1">
|
|
|
<template v-slot:mTitle>
|
|
|
{{title1}}
|
|
|
@@ -62,51 +62,18 @@ export default {
|
|
|
|
|
|
```
|
|
|
:::
|
|
|
-### No icon style
|
|
|
-:::demo
|
|
|
-
|
|
|
-```html
|
|
|
-<template>
|
|
|
- <nut-collapse v-model:active="activeName" :accordion="true">
|
|
|
- <nut-collapse-item :title="title1" :name="1">
|
|
|
- Introduce new features of vue3, such as composition API, teleport, emits, etc
|
|
|
- </nut-collapse-item>
|
|
|
- <nut-collapse-item :title="title2" :name="2">
|
|
|
- Full use of typescipt
|
|
|
- </nut-collapse-item>
|
|
|
- </nut-collapse>
|
|
|
-</template>
|
|
|
-<script>
|
|
|
-import { reactive, ref, toRefs } from 'vue';
|
|
|
-export default {
|
|
|
- setup() {
|
|
|
- const activeName = ref(1);
|
|
|
- const title = reactive({
|
|
|
- title1: 'title1',
|
|
|
- title2: 'title2',
|
|
|
- title3: 'title3',
|
|
|
- })
|
|
|
- return {
|
|
|
- activeName,
|
|
|
- ...toRefs(title)
|
|
|
- };
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-```
|
|
|
-:::
|
|
|
### accordion
|
|
|
|
|
|
-You can set accordion mode through 'accordion', and expand up to one panel. At this time, 'activename' is in string format` Subtitle ` you can set the content of a subtitle
|
|
|
+You can set accordion mode through 'accordion', and expand up to one panel. At this time, 'activename' is in string format` value ` you can set the content of a subtitle
|
|
|
|
|
|
:::demo
|
|
|
```html
|
|
|
<template>
|
|
|
- <nut-collapse v-model:active="activeName" :accordion="true" icon="down-arrow">
|
|
|
- <nut-collapse-item :title="title1" :name="1">
|
|
|
+ <nut-collapse v-model:active="activeName" :accordion="true">
|
|
|
+ <nut-collapse-item :title="title1" :name="1" :value="subTitle">
|
|
|
Build scenes based on JD design language system
|
|
|
</nut-collapse-item>
|
|
|
- <nut-collapse-item :title="title2" :name="2" :sub-title="subTitle">
|
|
|
+ <nut-collapse-item :title="title2" :name="2">
|
|
|
Improve the modularity and generality of the boundary
|
|
|
</nut-collapse-item>
|
|
|
<nut-collapse-item :title="title3" :name="3">
|
|
|
@@ -147,22 +114,21 @@ Set custom icons through icon and rotate to set the rotation angle of icons
|
|
|
<nut-collapse
|
|
|
v-model:active="activeName"
|
|
|
:accordion="true"
|
|
|
- icon="arrow-right2"
|
|
|
- rotate="90"
|
|
|
>
|
|
|
- <nut-collapse-item :title="title1" :name="1">
|
|
|
+ <nut-collapse-item :title="title1" :name="1" :icon="Notice">
|
|
|
<template v-slot:sTitle>
|
|
|
text test
|
|
|
</template>
|
|
|
NUTUI3. 0 rethink its internal consistency and composability
|
|
|
</nut-collapse-item>
|
|
|
- <nut-collapse-item :title="title2" :name="2" sub-title="text content">
|
|
|
+ <nut-collapse-item :title="title2" :name="2" :icon="Follow">
|
|
|
Improve the efficiency of production research output docking and reduce the output workload
|
|
|
</nut-collapse-item>
|
|
|
</nut-collapse>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { reactive, ref, toRefs } from 'vue';
|
|
|
+import { Notice, Follow } from '@nutui/icons-vue';
|
|
|
export default {
|
|
|
setup() {
|
|
|
const activeName = ref(1);
|
|
|
@@ -172,7 +138,9 @@ export default {
|
|
|
})
|
|
|
return {
|
|
|
activeName,
|
|
|
- ...toRefs(title)
|
|
|
+ ...toRefs(title),
|
|
|
+ Notice,
|
|
|
+ Follow
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
@@ -180,55 +148,15 @@ export default {
|
|
|
```
|
|
|
:::
|
|
|
|
|
|
-### Custom title Icon
|
|
|
-
|
|
|
-Set custom icons through icon and rotate to set the rotation angle of icons
|
|
|
-:::demo
|
|
|
-
|
|
|
-```html
|
|
|
-<template>
|
|
|
- <nut-collapse
|
|
|
- v-model:active="activeName"
|
|
|
- title-icon="issue"
|
|
|
- title-icon-color="red"
|
|
|
- title-icon-size="20px"
|
|
|
- title-icon-position="left"
|
|
|
- icon="down-arrow"
|
|
|
- :accordion="true"
|
|
|
- >
|
|
|
- <nut-collapse-item :title="title1" :name="1">
|
|
|
- component emits events are extracted separately to enhance code readability
|
|
|
- </nut-collapse-item>
|
|
|
- <nut-collapse-item :title="title2" :name="2" sub-title="文本内容">
|
|
|
- reconstruct and mount class components using the new feature of teleport
|
|
|
- </nut-collapse-item>
|
|
|
- </nut-collapse>
|
|
|
-</template>
|
|
|
-<script>
|
|
|
-import { reactive, ref, toRefs } from 'vue';
|
|
|
-export default {
|
|
|
- setup() {
|
|
|
- const activeName = ref(1);
|
|
|
- const title = reactive({
|
|
|
- title1: 'title1',
|
|
|
- title2: 'title2',
|
|
|
- })
|
|
|
- return {
|
|
|
- activeName,
|
|
|
- ...toRefs(title)
|
|
|
- };
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-```
|
|
|
-:::
|
|
|
### Set fixed content (do not collapse)
|
|
|
|
|
|
Set content through slot: extrarender
|
|
|
-
|
|
|
+
|
|
|
+:::demo
|
|
|
+
|
|
|
```html
|
|
|
<template>
|
|
|
- <nut-collapse v-model:active="activeName" icon="down-arrow" :accordion="true">
|
|
|
+ <nut-collapse v-model:active="activeName" :accordion="true">
|
|
|
<nut-collapse-item :title="title1" :name="1">
|
|
|
<template v-slot:extraRender>fixed content</template>
|
|
|
Nutui is a lightweight Vue component library with JD style
|
|
|
@@ -259,31 +187,36 @@ export default {
|
|
|
## API
|
|
|
### Collapse Props
|
|
|
|
|
|
-| Attribute | Description | Type | Default |
|
|
|
-|----- | ----- | ----- | -----
|
|
|
-| v-model | Of the currently expanded panel name | Accordion mode:string \| number<br>Non accordion mode:(string \| number)[] | - |
|
|
|
-| accordion | Whether to turn on accordion mode | boolean | false |
|
|
|
-| icon | Icon link and / or icon using nutui | string | ‘’ |
|
|
|
-| icon-size | Icon size | string | 16px |
|
|
|
-| icon-color | Icon color | string | '' |
|
|
|
-| title-icon | Title icon link and / or icon using nutui | string | ‘’ |
|
|
|
-| title-icon-size | Title icon size | string | 16px |
|
|
|
-| title-icon-color | Title icon color | string | ’‘ |
|
|
|
-| title-icon-position | Title icon location | string | ‘left' |
|
|
|
-| rotate | Click the rotation angle of collapse and expansion to take effect in the custom icon mode | string \ number | 180 |
|
|
|
-
|
|
|
+|Field | Description | Type | Default
|
|
|
+|----- | ----- | ----- | -----
|
|
|
+|V-model | name of the current expansion panel | accordion mode: string | number<br>Non accordion mode: (string | number) [] | -|
|
|
|
+|Accordion | Enable accordion mode |_boolean_ | `false` |
|
|
|
|
|
|
### CollapseItem Props
|
|
|
-| Attribute | Description | Type | Default |
|
|
|
+
|
|
|
+|Parameter | Description | Type | Default|
|
|
|
|------|------|------|------|
|
|
|
-|name | unique identifier, required | string \ number | - 1|
|
|
|
-|title | the content on the left side of the title bar supports slot incoming (props incoming has higher priority) | string | -|
|
|
|
-|sub-title | subtitle of title bar, support slot incoming (props incoming has higher priority) | string | -|
|
|
|
-|disabled | whether the title bar is disabled | Boolean | false|
|
|
|
-|slot:extrarender `v3.1.20`| set the fixed content under the title (no folding) | - | '|
|
|
|
+|Name | Unique identifier, required | string number | - 1|
|
|
|
+|Title | The content on the left side of the title bar supports slot incoming (the incoming priority of props is higher) | string | -|
|
|
|
+|Value | The content on the right side of the title bar supports slot incoming (the incoming priority of props is higher) | string | -|
|
|
|
+|Label | Title bar description information |_number \| string_ | - |
|
|
|
+|Rotate | Click the rotation angle of folding and unfolding to take effect in custom icon mode | string number | 180|
|
|
|
+|Disabled | Disable the title bar |_boolean_ | false |
|
|
|
+|Border | Display border |_boolean_ | `true` |
|
|
|
+
|
|
|
+
|
|
|
+### CollapseItem Slots
|
|
|
+
|
|
|
+|Slot name | Description|
|
|
|
+|------|------|
|
|
|
+|Slot: mTitle | Content slot on the left side of the title bar|
|
|
|
+|Slot: value | Right content slot of the title bar|
|
|
|
+|Slot: extraRender `v3.1.20 ` | Set fixed content under the title (no folding)|
|
|
|
+
|
|
|
|
|
|
|
|
|
### Events
|
|
|
-| Attribute | Description | Callback Arguments |
|
|
|
+
|
|
|
+|Event name | Description | Callback parameter|
|
|
|
|------|------|------|
|
|
|
-| change | Triggered when the panel is switched | The type is consistent with the value bound by V-model|
|
|
|
+|Change | Triggered when switching panels | The type is consistent with the value bound to the v-model|
|