From fe0187ac2c04c3b9fafd8bfdae817c6f9ab1d2ff Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 6 Apr 2026 23:56:06 +0800 Subject: [PATCH] scroll page to bottom when creating a new tag --- src/views/base/tags/TagListPageBase.ts | 4 ++-- src/views/desktop/tags/ListPage.vue | 15 ++++++++++++--- src/views/mobile/tags/ListPage.vue | 20 +++++++++++++++++--- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/views/base/tags/TagListPageBase.ts b/src/views/base/tags/TagListPageBase.ts index 42571ce0..0d8b371a 100644 --- a/src/views/base/tags/TagListPageBase.ts +++ b/src/views/base/tags/TagListPageBase.ts @@ -52,7 +52,7 @@ export function useTagListPageBase() { } } - function add(): void { + function createNewTag(): void { newTag.value = TransactionTag.createNewTag('', activeTagGroupId.value); } @@ -78,7 +78,7 @@ export function useTagListPageBase() { // functions isTagModified, switchTagGroup, - add, + createNewTag, edit }; } diff --git a/src/views/desktop/tags/ListPage.vue b/src/views/desktop/tags/ListPage.vue index 825c49f0..b108ecb8 100644 --- a/src/views/desktop/tags/ListPage.vue +++ b/src/views/desktop/tags/ListPage.vue @@ -258,7 +258,7 @@ - +
@@ -348,7 +348,7 @@ import RenameDialog from '@/components/desktop/RenameDialog.vue'; import ConfirmDialog from '@/components/desktop/ConfirmDialog.vue'; import SnackBar from '@/components/desktop/SnackBar.vue'; -import { ref, computed, useTemplateRef, watch } from 'vue'; +import { ref, computed, useTemplateRef, watch, nextTick } from 'vue'; import { useDisplay } from 'vuetify'; import { useI18n } from '@/locales/helpers.ts'; @@ -406,12 +406,13 @@ const { hasEditingTag, isTagModified, switchTagGroup, - add, + createNewTag, edit } = useTagListPageBase(); const transactionTagsStore = useTransactionTagsStore(); +const newTagRow = useTemplateRef('newTagRow'); const tagGroupChangeDisplayOrderDialog = useTemplateRef('tagGroupChangeDisplayOrderDialog'); const renameDialog = useTemplateRef('renameDialog'); const confirmDialog = useTemplateRef('confirmDialog'); @@ -461,6 +462,14 @@ function reload(): void { }); } +function add(): void { + createNewTag(); + + nextTick(() => { + newTagRow.value?.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); + }); +} + function addTagGroup(): void { renameDialog.value?.open('', tt('New Tag Group Name')).then((newName: string) => { updating.value = true; diff --git a/src/views/mobile/tags/ListPage.vue b/src/views/mobile/tags/ListPage.vue index 5e0167c7..ce3691bd 100644 --- a/src/views/mobile/tags/ListPage.vue +++ b/src/views/mobile/tags/ListPage.vue @@ -118,7 +118,7 @@ - + @@ -219,7 +219,7 @@