2020-02-03 21:20:21 +08:00
|
|
|
|
# 折叠面板 Collapse
|
2020-12-12 14:44:44 +08:00
|
|
|
|
|
2020-02-03 21:07:58 +08:00
|
|
|
|
我看到它总被用在界面边栏的控制面板上。
|
2020-12-12 14:44:44 +08:00
|
|
|
|
|
2020-02-03 21:07:58 +08:00
|
|
|
|
## 演示
|
2020-12-12 14:44:44 +08:00
|
|
|
|
|
2019-12-02 03:57:34 +08:00
|
|
|
|
```demo
|
|
|
|
|
basic
|
2020-04-28 22:07:06 +08:00
|
|
|
|
arrow-placement
|
2019-12-02 03:57:34 +08:00
|
|
|
|
accordion
|
|
|
|
|
nested
|
2020-05-28 13:08:59 +08:00
|
|
|
|
display-directive
|
2020-03-18 15:56:59 +08:00
|
|
|
|
item-header-click
|
2019-12-02 03:57:34 +08:00
|
|
|
|
```
|
2020-12-12 14:44:44 +08:00
|
|
|
|
|
2020-02-03 21:07:58 +08:00
|
|
|
|
## Props
|
2020-12-12 14:44:44 +08:00
|
|
|
|
|
2020-02-03 21:07:58 +08:00
|
|
|
|
### Collapse Props
|
2020-04-28 22:07:06 +08:00
|
|
|
|
|
2020-12-12 14:44:44 +08:00
|
|
|
|
| 名称 | 类型 | 默认值 | 说明 |
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
| accordion | `boolean` | `false` | |
|
|
|
|
|
| arrow-placement | `'left' \| 'right'` | `'left'` | |
|
|
|
|
|
| display-directive | `'if' \| 'show'` | `'if'` | 内部 `n-collapse-item` 在控制内容是否渲染时使用的指令,`'if'` 对应 `v-if`,`'show'` 对应 `v-show` |
|
|
|
|
|
| expanded-names | `Array<string \| number>` | `undefined` | |
|
|
|
|
|
| theme | `'light' \| 'dark' \| string` | `undefined` | |
|
|
|
|
|
| on-update-expanded-names | `(expandedNames: Array<string>) => any` | `undefined` | |
|
|
|
|
|
| on-item-header-click | `(data: { name: string, expanded: boolean, event: MouseEvent }) => any` | `undefined` | |
|
2020-02-03 21:07:58 +08:00
|
|
|
|
|
|
|
|
|
### Collapse Item Props
|
2020-12-12 14:44:44 +08:00
|
|
|
|
|
|
|
|
|
| 名称 | 类型 | 默认值 | 说明 |
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
| display-directive | `'if' \| 'show'` | `undefined` | 自身在控制内容是否渲染时使用的指令,`'if'` 对应 `v-if`,`'show'` 对应 `v-show`。在设定为 `undefined` 的时候跟随外层的 `n-collapse` |
|
|
|
|
|
| name | `string \| number` | required | |
|
|
|
|
|
| title | `string` | `undefined` | |
|
2020-02-03 21:07:58 +08:00
|
|
|
|
|
2020-02-03 21:20:21 +08:00
|
|
|
|
## Slots
|
2020-12-12 14:44:44 +08:00
|
|
|
|
|
2020-02-03 21:20:21 +08:00
|
|
|
|
### Collapse Slots
|
2020-12-12 14:44:44 +08:00
|
|
|
|
|
|
|
|
|
| 名称 | 参数 | 说明 |
|
|
|
|
|
| ------- | ---- | ---- |
|
|
|
|
|
| default | `()` | |
|
2020-02-03 21:20:21 +08:00
|
|
|
|
|
|
|
|
|
### Collapse Item Slots
|
|
|
|
|
|
2020-12-12 14:44:44 +08:00
|
|
|
|
| 名称 | 参数 | 说明 |
|
|
|
|
|
| ------- | ----------------------------------- | ---- |
|
|
|
|
|
| default | `()` | |
|
|
|
|
|
| header | `()` | |
|
|
|
|
|
| arrow | `(options: { collapsed: boolean })` | |
|