From 25651c5b9725b7db051fe52cc61af312c097fe3c Mon Sep 17 00:00:00 2001 From: ZonaHe Date: Wed, 6 Mar 2024 14:57:04 +0800 Subject: [PATCH] fix(tables): scroll to top on activated --- src/views/dashboard/modules/table-list.vue | 4 ++++ src/views/dashboard/modules/table-manager.vue | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/views/dashboard/modules/table-list.vue b/src/views/dashboard/modules/table-list.vue index 170e1aa0..cf316dd1 100644 --- a/src/views/dashboard/modules/table-list.vue +++ b/src/views/dashboard/modules/table-list.vue @@ -70,6 +70,10 @@ a-spin(style="width: 100%" :loading="tablesLoading") const treeRef = ref() const expandedKeys = ref() + onActivated(() => { + treeRef.value?.scrollIntoView({ top: 0 }) + }) + const refreshTables = () => { tablesSearchKey.value = '' getTables() diff --git a/src/views/dashboard/modules/table-manager.vue b/src/views/dashboard/modules/table-manager.vue index 48b6575c..c7d9644e 100644 --- a/src/views/dashboard/modules/table-manager.vue +++ b/src/views/dashboard/modules/table-manager.vue @@ -3,7 +3,12 @@ a-card.table-manager(:bordered="false") template(#title) a-space(:size="10") | Tables - a-button(type="outline" size="small" @click="refreshTables" :loading="totalTablesLoading") + a-button( + type="outline" + size="small" + :loading="totalTablesLoading" + @click="refreshTables" + ) template(#icon) svg.icon.brand-color use(href="#refresh") @@ -172,6 +177,10 @@ a-card.table-manager(:bordered="false") const expandedKeys = ref() + onActivated(() => { + tablesTreeRef.value?.scrollIntoView({ top: 0 }) + }) + const expandChildren = (event: Event, nodeData: TableTreeParent, type: 'details' | 'columns') => { if (nodeData[type].length && type !== nodeData.childrenType && expandedKeys.value?.includes(nodeData.key)) { event.stopPropagation()