Skip to content

Commit 279cf19

Browse files
committed
fix list loading
Signed-off-by: E99p1ant <i@github.red>
1 parent 164ca21 commit 279cf19

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

web/src/components/PageQuestions.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<Skeleton :loading="isLoading && questionCount === 0" :count="5"></Skeleton>
3-
<div v-if="!isLoading && questionCount > 0">
2+
<Skeleton :loading="isInitLoading" :count="5"></Skeleton>
3+
<div v-if="!isInitLoading && questionCount > 0">
44
<p class="uk-text-left uk-text-muted uk-text-small">@{{ props.pageProfileName }} 以前回答过的问题 ({{
55
questionCount
66
}})</p>
@@ -52,6 +52,7 @@ const props = defineProps({
5252
const router = useRouter()
5353
5454
const PAGE_SIZE = 20
55+
const isInitLoading = ref<boolean>(true)
5556
const isLoading = ref<boolean>(false)
5657
const hasMore = ref<boolean>(true)
5758
const questionCursor = ref<string>('')
@@ -72,6 +73,7 @@ const fetchQuestions = () => {
7273
})
7374
.finally(() => {
7475
isLoading.value = false
76+
isInitLoading.value = false
7577
})
7678
}
7779

web/src/pages/mine/QuestionList.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<Skeleton :count="3" :loading="isLoading">
2+
<Skeleton :count="3" :loading="isInitLoading"></Skeleton>
3+
<div v-if="!isInitLoading">
34
<a v-for="(question) in questions" v-bind:key="question.id" @click="handleView(question)">
45
<div>
56
<hr>
@@ -10,7 +11,7 @@
1011
<p class="uk-text-small">{{ question.content }}</p>
1112
</div>
1213
</a>
13-
</Skeleton>
14+
</div>
1415

1516
<div>
1617
<button v-if="hasMore" type="button" class="uk-button uk-button-default uk-width-1-1 uk-margin-small-bottom"
@@ -39,6 +40,7 @@ const router = useRouter()
3940
const authStore = useAuthStore()
4041
4142
const PAGE_SIZE = 20
43+
const isInitLoading = ref<boolean>(true)
4244
const isLoading = ref<boolean>(false)
4345
const hasMore = ref<boolean>(true)
4446
const questionCursor = ref<string>('')
@@ -56,6 +58,7 @@ const fetchQuestions = () => {
5658
})
5759
.finally(() => {
5860
isLoading.value = false
61+
isInitLoading.value = false
5962
})
6063
}
6164

0 commit comments

Comments
 (0)