Collapse 折叠面板

使用折叠面板收纳与展示内容。

基础用法

可同时展开多个面板。

Consistency
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;
Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.

手风琴模式

手风琴模式下同一时间只能展开一个面板。

使用 accordion 属性启用手风琴模式。

Consistency
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;
Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.

自定义标题

title 属性外,可通过具名插槽自定义标题,便于加入图标等内容。

TIP

title 插槽提供 isActive,表示当前折叠项是否展开。

自定义图标

icon 属性外,可通过具名插槽自定义面板图标。

Consistency
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;
Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.

自定义图标位置

使用 expand-icon-position 自定义展开图标位置。

expand icon position:
left

阻止折叠

设置 before-collapse:若返回 false,或返回的 Promise 被拒绝,则阻止折叠状态变化。

before collapse return:
true
Consistency
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;
Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.

折叠面板 API

折叠面板 属性

名称说明类型默认值
model-value / v-model当前激活面板;手风琴模式下为 string,否则为 arraystring / array[]
accordion是否手风琴模式booleanfalse
expand-icon-position展开图标位置enumright
before-collapse折叠状态变化前的钩子;返回 falsePromise 被拒绝时阻止折叠Function

折叠面板 事件

事件名说明类型
change激活面板变化时触发;手风琴模式参数为 string,否则为 arrayFunction

折叠面板 插槽

名称说明子标签
default自定义默认内容折叠面板子项

折叠面板 暴露

名称说明类型
activeNames当前激活面板名称object
setActiveNames设置激活面板名称Function

折叠面板项 API

折叠面板项 属性

名称说明类型默认值
name唯一标识string / number
title面板标题string''
icon面板图标string / ComponentArrowRight
disabled是否禁用该项booleanfalse

折叠面板项 插槽

名称说明
default折叠项默认内容
title标题内容;作用域类型 ^[object]`
icon图标内容;作用域类型 ^[object]`

折叠面板项 暴露

名称说明类型
isActive当前项是否处于展开态object