Skip to content

DraggableList 双列拖拽 ​

DraggableList 双列拖拽 的基础用法、公开 API 与示例。

基础示例 ​

在左右列表之间拖拽或点击转移条目。

示例使用本地演示数据;上传、校验和提交不会连接业务后端。

双列穿梭 ​

展示左右列表的状态回显和自定义标题。

示例使用本地演示数据;上传、校验和提交不会连接业务后端。

引入方式 ​

ts
import { DraggableList } from "@/components/page/draggable-list";

Props ​

参数说明类型默认值必填
leftList左侧数据DragList[][]否
rightList右侧数据DragList[][]否
leftTitle左侧标题string""否
rightTitle右侧标题string""否
leftWidth左侧宽度string"50%"否
rightWidth右侧宽度string"50%"否
dragClass拖拽元素 classDragClass{ left: [], right: [] }否
animation动画number200否

Events ​

事件名说明回调参数
onChangeonChange 事件触发时回调。value: { src: DragListSide; target: DragListSide; oldIndex?: number; newIndex?: number; },
itemClickitemClick 事件触发时回调。id: string, type: DragListSide

Slots ​

插槽名说明参数
leftTitleleftTitle 内容插槽。-
leftleft 内容插槽。item
leftIconleftIcon 内容插槽。-

Expose ​

名称说明类型
-该组件未声明 Expose。-

Module API ​

名称说明类型
DraggableList导出 DraggableList 供业务侧复用。useInstall(index)

Types ​

DraggableListProps ​

导出 DraggableListProps 供业务侧复用。

字段说明类型默认值必填
leftList左侧数据DragList[]-否
rightList右侧数据DragList[]-否
leftTitle左侧标题string-否
rightTitle右侧标题string-否
leftWidth左侧宽度string-否
rightWidth右侧宽度string-否
dragClass拖拽元素 classDragClass-否
animation动画number-否

DragList ​

导出 DragList 供业务侧复用。

字段说明类型默认值必填
id配置 id。string-是
name配置 name。string-是

DragClass ​

导出 DragClass 供业务侧复用。

字段说明类型默认值必填
left配置 left。string[]-是
right配置 right。string[]-是

DraggableListEmits ​

导出 DraggableListEmits 供业务侧复用。

字段说明类型默认值必填
onChange配置 onChange。[<br> value: {<br> src: DragListSide;<br> target: DragListSide;<br> oldIndex?: number;<br> newIndex?: number;<br> },<br> ]-是
itemClick配置 itemClick。[id: string, type: DragListSide]-是

API 根据当前组件源码生成;同步版本与验证记录见维护说明。