This commit is contained in:
owenchen committed 2026-08-28 17:02:34 +08:00
1 parent c253805122
commit 7df55a11bf
46 files changed
+3689 -27

No files matched your search

+7 -3
View File
@@ -60,6 +60,10 @@ const emit = defineEmits<EmitsType>();
const sortable = ref<Sortable | null>(null);
onMounted(() => {
let i: number = 0;
props.list.forEach((element: Column) => {
element.sequence = i++;
});
initDraggable();
});
@@ -82,13 +86,13 @@ const initDraggable = () => {
onUpdate(e: any) {
if (e.oldIndex !== undefined && e.newIndex !== undefined) {
// 删除拖拽的元素
const list = [...props.list];
let list = [...props.list];
const item = list.splice(e.oldIndex, 1)[0];
// 把删除的元素放到新的位置
list.splice(e.newIndex, 0, item);
let i: number = 0;
list.forEach((element: Column) => {
element.sequence = i++;
list = list.map((element: Column) => {
return { ...element, sequence: i++ };
});
emit('update:list', list);
emit('onChangeList', list);