This commit is contained in:
cutestnekoaqua 2023-01-19 18:28:07 +01:00
parent 66448b5e52
commit 5a2990a2fa
No known key found for this signature in database
GPG key ID: 6BF0964A5069C1E0
2 changed files with 8 additions and 17 deletions

View file

@ -90,6 +90,7 @@ const backed = ref(false); // 遡り中か否か
const isBackTop = ref(false); const isBackTop = ref(false);
const empty = computed(() => items.value.length === 0); const empty = computed(() => items.value.length === 0);
const error = ref(false); const error = ref(false);
const alreadyInitedOnce = ref(false);
const init = async (): Promise<void> => { const init = async (): Promise<void> => {
queue.value = []; queue.value = [];
@ -344,10 +345,14 @@ init();
onActivated(() => { onActivated(() => {
isBackTop.value = false; isBackTop.value = false;
if(alreadyInitedOnce.value) {
reload();
}
}); });
onDeactivated(() => { onDeactivated(() => {
isBackTop.value = window.scrollY === 0; isBackTop.value = window.scrollY === 0;
alreadyInitedOnce.value = true;
}); });
defineExpose({ defineExpose({

View file

@ -13,7 +13,7 @@
<MkButton primary class="start" @click="startUser"><i class="ph-plus-bold ph-lg"></i> {{ <MkButton primary class="start" @click="startUser"><i class="ph-plus-bold ph-lg"></i> {{
i18n.ts.startMessaging i18n.ts.startMessaging
}}</MkButton> }}</MkButton>
<MkPagination v-slot="{ items }" ref="paginationComponentUser" :pagination="dmsPagination"> <MkPagination v-slot="{ items }" :pagination="dmsPagination">
<MkChatPreview v-for="message in items" :key="message.id" class="yweeujhr message _block" <MkChatPreview v-for="message in items" :key="message.id" class="yweeujhr message _block"
:message="message" /> :message="message" />
</MkPagination> </MkPagination>
@ -28,7 +28,7 @@
i18n.ts.startMessaging i18n.ts.startMessaging
}}</MkButton> }}</MkButton>
</div> </div>
<MkPagination v-slot="{ items }" ref="paginationComponentGroup" :pagination="groupsPagination"> <MkPagination v-slot="{ items }" :pagination="groupsPagination">
<MkChatPreview v-for="message in items" :key="message.id" class="yweeujhr message _block" <MkChatPreview v-for="message in items" :key="message.id" class="yweeujhr message _block"
:message="message" /> :message="message" />
</MkPagination> </MkPagination>
@ -41,7 +41,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { markRaw, onMounted, onUnmounted, watch, computed, onActivated, onDeactivated } from 'vue'; import { markRaw, onMounted, onUnmounted, watch, computed } from 'vue';
import * as Acct from 'calckey-js/built/acct'; import * as Acct from 'calckey-js/built/acct';
import { Virtual } from 'swiper'; import { Virtual } from 'swiper';
import { Swiper, SwiperSlide } from 'swiper/vue'; import { Swiper, SwiperSlide } from 'swiper/vue';
@ -212,20 +212,6 @@ onMounted(() => {
onUnmounted(() => { onUnmounted(() => {
if (connection) connection.dispose(); if (connection) connection.dispose();
}); });
// temporary hot fix of the temporary hot fix
let alreadyInit = $ref(false);
onActivated(() => {
if (alreadyInit.value) {
paginationComponentUser.reload();
paginationComponentGroup.reload();
}
});
onDeactivated(() => {
alreadyInit.value = true;
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>