Element UI 是为 Vue 2 设计的,而 Element Plus 是 Element UI 的 Vue 3 版本。在这两个版本中,Transfer 穿梭框组件(如果有的话)的 API 和使用方式可能会有所不同。以下是根据我对这两个版本组件的了解,对 Vue 2 的 Element UI 和 Vue 3 的 Element Plus 中的 Transfer 穿梭框组件的属性、事件和方法的区分介绍。
Vue 2 + Element UI
在 Element UI 中,Transfer 穿梭框组件允许用户通过两列列表来移动选项,通常用于分类选择或数据筛选。
属性 (Attributes)
data
: 穿梭框的数据源,格式为数组,每个元素是一个对象,至少包含key
、label
、disabled
等字段titles
: 列表标题的数组,长度应为 2filterable
: 是否可搜索filter-method
: 自定义搜索方法props
: 配置选项,用于指定data
数组中每个元素的哪个字段作为选项的 key、label、disabled 等target-keys
: 选中项对应的key
数组render-content
: 自定义内容渲染函数...
: 其他通用属性
事件 (Events)
change
: 选中项发生变化时触发