Selaa lähdekoodia

消息通知:<=0的时候隐藏数字提示

Xiao_123 4 kuukautta sitten
vanhempi
commit
920c8fbfe5
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      src/layout/components/LayoutNotification.vue

+ 2 - 2
src/layout/components/LayoutNotification.vue

@@ -60,7 +60,7 @@
         <m-empty v-if="items.length === 0" description="暂无通知"></m-empty>
       </div>
     </div>
-    <el-badge class="cursor-pointer" slot="reference" :value="unreadTotal" :max="99" :hidden="unreadTotal === 0">
+    <el-badge class="cursor-pointer" slot="reference" :value="unreadTotal" :max="99" :hidden="unreadTotal <= 0">
       <span class="el-icon-bell"></span>
     </el-badge>
   </el-popover>
@@ -169,7 +169,7 @@ export default {
     async onSet (item) {
       try {
         await setMessageRead({ messageId: item.messageId })
-        this.unreadTotal--
+        if (+this.unreadTotal > 0) this.unreadTotal--
         item.readState = 1
       } catch (error) {
         this.$message.error(error)