1.0.1 • Published 6 years ago

transfer-box v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

transfer-box

安装

npm install "transfer-box"

使用

  • 引入组件,因为selectbox依赖于antd的table,所以如果发现样式缺失,说明项目启动后从没引用过antd的table,此时需要手动引用
import SelectBox from 'transfer-box';
import 'antd/lib/table/style'; //如果需要的话引用antd的table样式
  • 引入selectbox样式

在项目入口引入“transfer-box/lib/index.less” 或 “transfer-box/lib/index.css”

@import '~transfer-box/lib/index.less';

参数

PropTypeDescriptiondefault
styleobject样式,如果此处设置了width或height会覆盖掉上边的width,height-
childrenLoadQueryKeystring请求子节点key名称planId
childrenLoadUrlstring请求子节点的url, expandable为true时,该属性必须设置-
childrenLoadParamobject请求子节点参数-
disabledPropsKeystring用于判断选中状态的keyisSelected
heightnumber高度450
widthnumber宽度-
loadingLbool左侧显示loading-
loadingRbool右侧显示loading-
parentSelectablebool父节点是否可选中true
allSelectbool是否显示全部添加false
expandablebool是否可展开true
dataSourceLarray左侧数据源[]
dataSourceRarray右侧数据源[]
keyFieldstringid字段名id
displayFieldstring展示字段名name
childCountFieldstring表示子节点数量的字段名称-
searchPlaceholderstring搜索框提示语-
titlestring左右两侧box标题,左侧目前无效{ l: '', r: '' }
maxSelectedCountnumber最大可选择数量-
maxErrorCBfunction超出最大数量的回调函数弹框提示
labelRenderFuncfunction标签渲染函数-

API

方法名Descriptionparams
getSelection返回当前selectbox的状态
clear清空box状态

图示