feat: unread ui

This commit is contained in:
tim
2025-07-07 19:36:40 +08:00
parent 7237eba192
commit fbf0d9fe2f

View File

@@ -9,7 +9,9 @@
<router-link class="menu-item" exact-active-class="selected" to="/message"> <router-link class="menu-item" exact-active-class="selected" to="/message">
<i class="menu-item-icon fas fa-envelope"></i> <i class="menu-item-icon fas fa-envelope"></i>
<span class="menu-item-text">我的消息</span> <span class="menu-item-text">我的消息</span>
<span v-if="unreadCount > 0" class="unread-dot"></span> <span v-if="unreadCount > 0" class="unread-container">
<span class="unread"> {{ showUnreadCount }} </span>
</span>
</router-link> </router-link>
<router-link class="menu-item" exact-active-class="selected" to="/about"> <router-link class="menu-item" exact-active-class="selected" to="/about">
<i class="menu-item-icon fas fa-info-circle"></i> <i class="menu-item-icon fas fa-info-circle"></i>
@@ -56,6 +58,9 @@ export default {
default: default:
return 'fas fa-desktop' return 'fas fa-desktop'
} }
},
showUnreadCount() {
return this.unreadCount > 99 ? '99+' : this.unreadCount
} }
}, },
async mounted() { async mounted() {
@@ -91,11 +96,12 @@ export default {
} }
.menu-item { .menu-item {
display: block;
padding: 4px 10px; padding: 4px 10px;
text-decoration: none; text-decoration: none;
color: var(--menu-text-color); color: var(--menu-text-color);
border-radius: 10px; border-radius: 10px;
display: flex;
align-items: center;
} }
.menu-item.selected { .menu-item.selected {
@@ -109,18 +115,27 @@ export default {
color: var(--menu-text-color); color: var(--menu-text-color);
} }
.unread-container {
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background-color: rgb(255, 102, 102);
margin-left: 15px;
width: 18px;
height: 18px;
text-align: center;
}
.unread {
color: white;
font-size: 9px;
font-weight: bold;
}
.menu-item-icon { .menu-item-icon {
margin-right: 10px; margin-right: 10px;
opacity: 0.5; opacity: 0.5;
} font-weight: bold;
.unread-dot {
display: inline-block;
width: 8px;
height: 8px;
margin-left: 4px;
border-radius: 50%;
background-color: red;
} }
.menu-footer { .menu-footer {