backedがfalseになったら通知を既読にする

This commit is contained in:
tamaina 2023-07-24 07:19:22 +00:00
parent 7ccdd503b7
commit d6e57059e4
2 changed files with 9 additions and 2 deletions

View file

@ -17,7 +17,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onUnmounted, onMounted, computed, shallowRef } from 'vue'; import { onUnmounted, onMounted, computed, shallowRef, watch } from 'vue';
import MkPagination, { Paging } from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import XNotification from '@/components/MkNotification.vue'; import XNotification from '@/components/MkNotification.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue'; import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
@ -50,10 +50,16 @@ const onNotification = (notification) => {
} }
if (!isMuted) { if (!isMuted) {
pagingComponent.value.prepend(notification); pagingComponent.value?.prepend(notification);
} }
}; };
watch(() => pagingComponent.value?.backed, (backed) => {
if (backed === false) {
useStream().send('readNotification');
}
});
let connection; let connection;
onMounted(() => { onMounted(() => {

View file

@ -568,6 +568,7 @@ defineExpose({
more, more,
inited, inited,
queueSize, queueSize,
backed: $$(backed),
reload, reload,
prepend, prepend,
append: appendItem, append: appendItem,