From ace2aec85b4747ae7148e10b39f687f3e87567e6 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 5 Mar 2025 13:28:50 +0700 Subject: [PATCH] feat: unread count --- src/layouts/MainLayout.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index be00b93f..11bb48e7 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -19,6 +19,7 @@ import { initLang, initTheme, Lang, setLang } from 'src/utils/ui'; import { baseUrl } from 'stores/utils'; import { useNotification } from 'src/stores/notification'; import moment from 'moment'; +import { computed } from 'vue'; const useMyBranch = useMyBranchStore(); const { fetchListMyBranch } = useMyBranch; @@ -47,7 +48,9 @@ const leftDrawerOpen = ref(false); const leftDrawerMini = ref(false); const filterUnread = ref(false); -const unread = ref(1); +const unread = computed( + () => notificationData.value.filter((v) => !v.read).length || 0, +); // const filterRole = ref(); const userImage = ref(); const userGender = ref(''); @@ -316,9 +319,9 @@ onMounted(async () => { clickable class="q-py-sm" v-ripple - v-for="(item, i) in !filterUnread + v-for="(item, i) in filterUnread ? notificationData.filter((v) => !v.read) - : notificationData.filter((v) => v.read)" + : notificationData" @click="notificationStore.getNotification(item.id)" :key="i" >