From d418b3e5ceea4fed2407e963b7f44f5cdafd42df Mon Sep 17 00:00:00 2001 From: lisonge Date: Mon, 26 Feb 2024 11:51:58 +0800 Subject: [PATCH] perf: loading --- src/views/HomePage.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/views/HomePage.vue b/src/views/HomePage.vue index f7d6195..258ced7 100644 --- a/src/views/HomePage.vue +++ b/src/views/HomePage.vue @@ -31,6 +31,7 @@ import { import type { SortState } from 'naive-ui/es/data-table/src/interface'; import { computed, + onMounted, reactive, shallowReactive, shallowRef, @@ -42,11 +43,14 @@ import { RouterLink, useRouter } from 'vue-router'; const router = useRouter(); const snapshots = shallowRef([]); +const loading = shallowRef(true); const updateSnapshots = async () => { + loading.value = true; snapshots.value = (await shallowSnapshotStorage.getAllItems()).reverse(); checkedRowKeys.value = []; + loading.value = false; }; -updateSnapshots(); +onMounted(updateSnapshots); const filterOption = shallowReactive({ query: ``, actualQuery: ``, @@ -428,6 +432,7 @@ const shareDlgShow = shallowRef(false); size="small" class="flex-1" flexHeight + :loading="loading" />