0.1.1 • Published 5 years ago

k2-transfer v0.1.1

Weekly downloads
7
License
-
Repository
github
Last release
5 years ago

k2-transfer 穿梭框组件

注意:次组件依赖 iview,请确保已安装 iview

使用

npm install k2-transfer --save

使用及文档可以查看iview Transfer,该组件只是在其基础上进行增强。

新增功能

  1. 支持自定义穿梭框最外层 container 样式
  2. 支持双击某项来进行穿梭(如双击左栏某项,该项自动进入右栏,不需要点击中间的箭头)
  3. 支持鼠标 shift 一次性多选
  4. 支持键盘操作(In progress)

API

Transfer props

兼容 iview Transfer 组件所有 API, (*) 为 K2Transfer 新增API

属性说明类型默认值
data数据源,其中的数据将会被渲染到左边一栏中,targetKeys 中指定的除外。Array[]
targetKeys显示在右侧框数据的key集合Array[]
render-format每行数据渲染函数,该函数的入参为 data 中的项Function默认显示label,没有时显示key
selected-keys设置哪些项应该被选中Array[]
styles (*)穿梭框最外层容器自定义样式Object{}
list-style两个穿梭框的自定义样式Object{}
titles标题集合,顺序从左至右Array'源列表', '目的列表'
operations操作文案集合,顺序从上至下Array[]
doubleClick (*)时候支持双击Booleantrue
filterable是否显示搜索框Booleanfalse
filter-placeholder搜索框的占位String请输入搜索内容
filter-method自定义搜索函数,入参为 data 和 query,data 为项,query 为当前输入的搜索词Function默认搜索label
not-found-text当列表为空时显示的内容String列表为空

Transfer events

事件名说明返回值
on-change选项在两栏之间转移时的回调函数targetKeys, direction, moveKeys
on-dblclick (*)双击项时触发targetKeys, direction, moveKeys
on-selected-change选中项发生变化时触发sourceSelectedKeys, targetSelectedKeys

Transfer slot

名称说明
自定义底部内容