fix: new posts click
This commit is contained in:
parent
e2f60e20dc
commit
4f1c71a8d5
2 changed files with 10 additions and 6 deletions
|
@ -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>
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue