From dae8c5016c0b8894119618754acfe509123d2f91 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 30 Apr 2025 10:29:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8B=96=E5=8A=A8=E6=8E=92=E5=BA=8F=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileUpload/index.vue | 29 +++++++++++++++++++++++++++- src/components/ImageUpload/index.vue | 28 ++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 49ead36..d217897 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -42,6 +42,7 @@ +// 初始化拖拽排序 +onMounted(() => { + if (props.drag) { + nextTick(() => { + const element = document.querySelector('.upload-file-list') + Sortable.create(element, { + ghostClass: 'file-upload-darg', + onEnd: (evt) => { + const movedItem = fileList.value.splice(evt.oldIndex, 1)[0] + fileList.value.splice(evt.newIndex, 0, movedItem) + emit('update:modelValue', listToString(fileList.value)) + } + }) + }) + } +}) +