Transfer穿梭框·续2

titles 标题集合,顺序从左至右 string[] [‘’, ‘’]

事件

事件名称 说明 回调参数 版本
change 选项在两栏之间转移时的回调函数 (targetKeys, direction, moveKeys): void
scroll 选项列表滚动时的回调函数 (direction, event): void

| search | 搜索框内容时改变时的回调函数 | (direction: ‘left’|’right’, value: string): void | - | |---|---|---|---|

selectChange 选中项发生改变时的回调函数 (sourceSelectedKeys, targetSelectedKeys): void

Render Props

Transfer 支持接收 children 自定义渲染列表,并返回以下参数:

{  "direction": String,  "disabled": Boolean,  "filteredItems": Array,  "selectedKeys": Array,  "onItemSelect": Function,  "onItemSelectAll": Function}
参数 说明 类型 版本

| direction | 渲染列表的方向 | ‘left’ | ‘right’ | | |---|---|---|---|

disabled 是否禁用列表 boolean
filteredItems 过滤后的数据 TransferItem[]
selectedKeys 选中的条目 string[]
itemSelect 勾选条目 (key: string, selected: boolean)
itemSelectAll 勾选一组条目 (keys: string[], selected: boolean)

参考示例

<​a-transfer>  <​template    #children="{      direction,      filteredItems,      selectedKeys,      disabled: listDisabled,      onItemSelectAll,      onItemSelect,    }"  >    <​your-component />  <​template><​/a-transfer>

注意

按照 Vue 最新的规范,所有的组件数组最好绑定 key。在 Transfer 中,dataSource里的数据值需要指定 key 值。对于 dataSource 默认将每列数据的 key 属性作为唯一的标识。

如果你的数据没有这个属性,务必使用 rowKey 来指定数据列的主键。

// 比如你的数据主键是 uidreturn <​Transfer :rowKey="record => record.uid" />;