From 3f4f215cf3f62515fc41ed48ef027d7e84984860 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Mon, 2 Sep 2024 00:34:40 +0900 Subject: [PATCH] refactor --- .../src/components/MkPostFormAttaches.vue | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/frontend/src/components/MkPostFormAttaches.vue b/packages/frontend/src/components/MkPostFormAttaches.vue index 2c45e64721..9eee090654 100644 --- a/packages/frontend/src/components/MkPostFormAttaches.vue +++ b/packages/frontend/src/components/MkPostFormAttaches.vue @@ -13,9 +13,9 @@ SPDX-License-Identifier: AGPL-3.0-only @drop.stop >
-
- -
+
+ +
@@ -51,15 +51,14 @@ const emit = defineEmits<{ const dndParentEl = shallowRef(); -const fileKvs = computed(() => Object.fromEntries(props.modelValue.map(file => [file.id, file]))); -const fileIds = computed({ - get: () => props.modelValue.map(file => file.id), - set: (ids: string[]) => emit('update:modelValue', ids.map(id => fileKvs.value[id])), +const files = computed({ + get: () => props.modelValue, + set: (v) => emit('update:modelValue', v), }); dragAndDrop({ parent: dndParentEl, - values: fileIds, + values: files, plugins: [animations()], });