fix: new posts click

This commit is contained in:
freeplay 2023-07-01 21:48:18 -04:00
parent e0581f8999
commit 934a21776c
2 changed files with 10 additions and 6 deletions

View file

@ -12,7 +12,7 @@
</template>
<template #default="{ items: notes }">
<div class="giivymft" :class="{ noGap }">
<div class="giivymft" :class="{ noGap }" ref="tlEl">
<XList
ref="notes"
v-slot="{ item: note }"
@ -41,6 +41,9 @@ import XNote from "@/components/MkNote.vue";
import XList from "@/components/MkDateSeparatedList.vue";
import MkPagination from "@/components/MkPagination.vue";
import { i18n } from "@/i18n";
import { scroll } from "@/scripts/scroll";
const tlEl = ref<HTMLElement>();
const props = defineProps<{
pagination: Paging;
@ -49,8 +52,13 @@ const props = defineProps<{
const pagingComponent = ref<InstanceType<typeof MkPagination>>();
function scrollTop() {
scroll(tlEl.value, { top: 0, behavior: 'smooth' })
}
defineExpose({
pagingComponent,
scrollTop
});
</script>

View file

@ -12,7 +12,7 @@
<div v-if="queue > 0" class="new">
<button
class="_buttonPrimary _shadow"
@click="scrollTop"
@click="tlComponent.scrollTop()"
:class="{ instant: !$store.state.animation }"
>
{{ i18n.ts.newNoteRecived }}
@ -37,7 +37,6 @@ import * as sound from "@/scripts/sound";
import { $i } from "@/account";
import { i18n } from "@/i18n";
import { defaultStore } from "@/store";
import { scroll } from "@/scripts/scroll";
const props = defineProps<{
src: string;
@ -223,9 +222,6 @@ function closeHint() {
break;
}
}
function scrollTop() {
scroll(tlComponent, { top: 0, behavior: 'smooth' })
}
const pagination = {
endpoint: endpoint,