This commit is contained in:
yawhn 2023-01-19 19:54:27 +02:00
commit 8453d05115
2 changed files with 14 additions and 7 deletions

View File

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

View File

@ -13,8 +13,8 @@
<MkButton primary class="start" @click="startUser"><i class="ph-plus-bold ph-lg"></i> {{
i18n.ts.startMessaging
}}</MkButton>
<MkPagination v-slot="{ items }" :externalItemArray="messages" :pagination="dmsPagination">
<MkChatPreview v-for="message in messages" :key="message.id" class="yweeujhr message _block"
<MkPagination v-slot="{ items }" :pagination="dmsPagination">
<MkChatPreview v-for="message in items" :key="message.id" class="yweeujhr message _block"
:message="message" />
</MkPagination>
</div>
@ -28,8 +28,8 @@
i18n.ts.startMessaging
}}</MkButton>
</div>
<MkPagination v-slot="{ items }" :externalItemArray="groupMessages" :pagination="groupsPagination">
<MkChatPreview v-for="message in groupMessages" :key="message.id" class="yweeujhr message _block"
<MkPagination v-slot="{ items }" :pagination="groupsPagination">
<MkChatPreview v-for="message in items" :key="message.id" class="yweeujhr message _block"
:message="message" />
</MkPagination>
</div>
@ -62,8 +62,9 @@ import 'swiper/scss/virtual';
const router = useRouter();
let messages = $ref([]);
let groupMessages = $ref([]);
let connection = $ref(null);
let paginationComponentUser = $ref<InstanceType<typeof MkPagination>>();
let paginationComponentGroup = $ref<InstanceType<typeof MkPagination>>();
const tabs = ['dms', 'groups'];
let tab = $ref(tabs[0]);
@ -116,9 +117,10 @@ function onMessage(message): void {
messages.unshift(message);
} else if (message.groupId) {
groupMessages = groupMessages.filter(m => m.groupId !== message.groupId);
groupMessages.unshift(message);
messages = messages.filter(m => m.groupId !== message.groupId);
messages.unshift(message);
}
forceRerender();
}
function onRead(ids): void {