Split 面板分割

Split 面板分割

概述

可将一片区域,分割为可以拖拽调整宽度或高度的两部分区域。

代码示例

<template> <div class="demo-split"> <Split v-model="split1"> <div slot="left" class="demo-split-pane"> Left Pane </div> <div slot="right" class="demo-split-pane"> Right Pane </div> </Split> </div> </template> <script> export default { data () { return { split1: 0.5 } }, } </script> <style> .demo-split{ height: 200px; border: 1px solid #dcdee2; } .demo-split-pane{ padding: 10px; } </style>

<template> <div class="demo-split"> <Split v-model="split2" mode="vertical"> <div slot="top" class="demo-split-pane"> Top Pane </div> <div slot="bottom" class="demo-split-pane"> Bottom Pane </div> </Split> </div> </template> <script> export default { data () { return { split2: 0.5 } }, } </script> <style> .demo-split{ height: 200px; border: 1px solid #dcdee2; } .demo-split-pane{ padding: 10px; } </style>

<template> <div class="demo-split"> <Split v-model="split3"> <div slot="left" class="demo-split-pane no-padding"> <Split v-model="split4" mode="vertical"> <div slot="top" class="demo-split-pane"> Top Pane </div> <div slot="bottom" class="demo-split-pane"> Bottom Pane </div> </Split> </div> <div slot="right" class="demo-split-pane"> Right Pane </div> </Split> </div> </template> <script> export default { data () { return { split3: 0.5, split4: 0.5 } }, } </script> <style> .demo-split{ height: 200px; border: 1px solid #dcdee2; } .demo-split-pane{ padding: 10px; } .demo-split-pane.no-padding{ height: 200px; padding: 0; } </style>

API

Split props

属性说明类型默认值
value面板位置,可以是 0~1 代表百分比,或具体数值的像素,可用 v-model 双向绑定Number | String0.5
mode类型,可选值为 horizontal 或 verticalStringhorizontal
min最小阈值Number | String40px
max最大阈值Number | String40px

Split events

事件名说明返回值
on-move-start拖拽开始-
on-moving拖拽中event
on-move-end拖拽结束-

Split slot

名称说明
leftmode 为 horizontal 时可用,左边面板
rightmode 为 horizontal 时可用,右边面板
topmode 为 vertical 时可用,上边面板
bottommode 为 vertical 时可用,下边面板
trigger自定义分割拖拽节点