@@ -3,20 +3,43 @@ import { useI18n } from "vue-i18n";
33import { ref , computed } from " vue" ;
44import { noticesData } from " ./data" ;
55import NoticeList from " ./components/NoticeList.vue" ;
6+
67import BellIcon from " ~icons/lucide/bell" ;
8+ import ArrowRightIcon from " ~icons/ri/arrow-right-s-line" ;
79
810const { t } = useI18n ();
11+ const dropdownRef = ref ();
912const notices = ref (noticesData );
1013const activeKey = ref (noticesData [0 ]?.key );
1114
1215const getLabel = computed (
1316 () => item =>
1417 t (item .name ) + (item .list .length > 0 ? ` (${item .list .length }) ` : " " )
1518);
19+
20+ const currentNoticeHasData = computed (() => {
21+ const currentNotice = notices .value .find (
22+ item => item .key === activeKey .value
23+ );
24+ return currentNotice && currentNotice .list .length > 0 ;
25+ });
26+
27+ const onWatchMore = () => {
28+ dropdownRef .value .handleClose ();
29+ };
30+
31+ const onMarkAsRead = () => {
32+ const currentNotice = notices .value .find (
33+ item => item .key === activeKey .value
34+ );
35+ if (currentNotice ) {
36+ currentNotice .list = [];
37+ }
38+ };
1639 </script >
1740
1841<template >
19- <el-dropdown trigger =" click" placement =" bottom-end" >
42+ <el-dropdown ref = " dropdownRef " trigger =" click" placement =" bottom-end" >
2043 <span
2144 :class =" ['dropdown-badge', 'navbar-bg-hover', 'select-none', 'mr-[7px]']"
2245 >
@@ -42,7 +65,7 @@ const getLabel = computed(
4265 <span v-else >
4366 <template v-for =" item in notices " :key =" item .key " >
4467 <el-tab-pane :label =" getLabel(item)" :name =" `${item.key}`" >
45- <el-scrollbar max-height =" 330px " >
68+ <el-scrollbar max-height =" 345px " >
4669 <div class =" noticeList-container" >
4770 <NoticeList :list =" item .list " :emptyText =" item .emptyText " />
4871 </div >
@@ -51,6 +74,20 @@ const getLabel = computed(
5174 </template >
5275 </span >
5376 </el-tabs >
77+ <div
78+ v-if =" currentNoticeHasData"
79+ class =" border-t border-t-(--el-border-color-light) text-sm"
80+ >
81+ <div class =" flex-bc m-1" >
82+ <el-button type =" primary" size =" small" text @click =" onWatchMore" >
83+ {{ t("buttons.pureWatchMore") }}
84+ <IconifyIconOffline :icon =" ArrowRightIcon " />
85+ </el-button >
86+ <el-button type =" primary" size =" small" text @click =" onMarkAsRead" >
87+ {{ t("buttons.pureMarkAsRead") }}
88+ </el-button >
89+ </div >
90+ </div >
5491 </el-dropdown-menu >
5592 </template >
5693 </el-dropdown >
0 commit comments