Skip to content

FxSplitter 分割面板

将区域水平或垂直分割,并可自由拖拽调整每个区域的大小。

基础用法

最基础的用法,若不传入默认尺寸,将自动等分。

垂直布局

使用垂直方向分割。

折叠

配置 collapsible 可提供快速收起的能力。可配合 min 属性避免折叠后通过拖拽展开。

禁用拖拽

当任意一侧面板禁用 resizable 时,拖拽将被禁用。

面板尺寸

通过 v-model:size 可获取/设置面板尺寸。

懒加载

开启 lazy 后,拖拽过程中面板尺寸不会实时更新,仅在拖拽结束后更新。

Splitter API

Attributes

属性说明类型默认值
layout分割面板布局方向'horizontal' | 'vertical''horizontal'
lazy是否启用懒加载booleanfalse

Events

事件名说明类型
resize-start开始调整面板尺寸时触发,index 为拖拽条索引(index: number, sizes: number[]) => void
resize调整面板尺寸过程中触发,index 为拖拽条索引(index: number, sizes: number[]) => void
resize-end调整面板尺寸结束时触发,index 为拖拽条索引(index: number, sizes: number[]) => void
collapse面板折叠时触发,index 为拖拽条索引(index: number, type: 'start' | 'end', sizes: number[]) => void

SplitterPanel API

Attributes

属性说明类型默认值
size / v-model:size面板尺寸(像素或百分比)string | number
min面板最小尺寸(像素或百分比)string | number
max面板最大尺寸(像素或百分比)string | number
resizable是否可调整尺寸booleantrue
collapsible是否可折叠booleanfalse

Events

事件名说明类型
update:size面板尺寸变化时触发(size: number) => void

Slots

插槽名说明
default面板默认内容
start-collapsible起始折叠按钮的自定义内容
end-collapsible结束折叠按钮的自定义内容

Exposes

名称说明类型
splitterPanelRef面板根 HTML 元素Ref<HTMLDivElement>