From 09c06369c0b24017048bc2c8a4a068acde5b6106 Mon Sep 17 00:00:00 2001 From: ThrRip Date: Wed, 29 Nov 2023 03:26:42 +0800 Subject: [PATCH] admin: Improve UI details and animations --- packages/admin/components/PlaylistList.vue | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/admin/components/PlaylistList.vue b/packages/admin/components/PlaylistList.vue index be2d76d..aecf4e8 100644 --- a/packages/admin/components/PlaylistList.vue +++ b/packages/admin/components/PlaylistList.vue @@ -143,7 +143,7 @@
@@ -201,11 +201,10 @@ class="overflow-y-scroll flex flex-col portrait:gap-y-5 px-2 pt-2.5 portrait:pt-4 pb-14 portrait:pb-16 bg-white-alta" >
{{ props.data.find(unmodified => unmodified.$id === song.$id)?.language }} @@ -480,16 +479,16 @@ const listArea = ref() function scrollList (position: 'top' | 'bottom') { switch (position) { case 'top': - listArea.value?.scroll({ + nextTick(() => listArea.value?.scroll({ top: 0, behavior: 'smooth' - }) + })) break case 'bottom': - listArea.value?.scroll({ + nextTick(() => listArea.value?.scroll({ top: listArea.value?.scrollHeight, behavior: 'smooth' - }) + })) } } @@ -529,9 +528,9 @@ function modifyNext (currentTarget: ModifyTarget) { function create () { const id = crypto.randomUUID() emit('stageChanges', { $id: id, hidden: false, name: '', artist: '', payment_amount: null, language: '' }) - setTimeout(() => scrollList('bottom'), 50) + scrollList('bottom') modifyingTarget.value.id = id modifyingTarget.value.field = 'name' - setTimeout(() => modifyingInput.value?.[0]?.focus(), 2000) + nextTick(() => modifyingInput.value?.[0]?.focus({ preventScroll: true })) }