0.1.4 • Published 1 year ago

react-split-pane-smart v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Split Pane Smart

本组件基于 react-split-pane-next 1.0.6版本开发而来

解决了此组件本身有的bug以及添加了扩展性

Install

npm install react-split-pane-smart

# or if you use yarn

yarn add react-split-pane-smart

Usage

import SplitPane, { Pane } from 'react-split-pane-smart';

<SplitPane split="vertical">
  <Pane initialSize="200px">You can use a Pane component</Pane>
  <div>or you can use a plain old div</div>
  <Pane initialSize="25%" minSize="10%" maxSize="500px">
    Using a Pane allows you to specify any constraints directly
  </Pane>
</SplitPane>;

SplitPane 可选属性有:

可选属性作用属性类型默认值
onDrag拖动分割线时回调(event: React.MouseEvent) => voidundefined
resizerClassName分割线classstring‘’
resizerChildNode分割线子元素React.ReactNodenull
resizerMouseOver分割线鼠标悬浮时回调函数(event: MouseEvent) => voidundefined
onResizeEnd鼠标抬起时会触发,返回两个面板大小(value: ,number) => voidundefined
onResizeStart鼠标在分割线按下时会触发(event: MouseEvent) => voidundefined
onChange布局发生变化时会调用(value: number,number) => voidundefined
className类名stringundefined
split排布方式stringvertical | horizontal
resizerSize分割线宽度:计算元素大小时会用到number1
needExactSizes是否需要返回精确的地面板大小。关闭有利于性能。string,stringfalse

Pane可选属性

可选属性作用属性类型默认值
className类型stringundefined
initialSize第一次渲染时面板大小:可以是例如 ’1‘ 、'24%'`、'200px'类型的值 | string | '0'
minSize面板最小值:类型如initialSizestringundefined
maxSize面板最大值:类型如initialSizestring'100%'
size设置面板值:类型如initialSizestringundefined
注意当同时具有size和initialSize时,优先使用size渲染面板大小