import { reactive, watch } from 'vue'; // 全局消息状态管理 export const messageStore = reactive({ unreadCount: 0, // 初始未读数为 0,由 App.vue onShow 触发刷新 // 更新未读数的方法 setUnreadCount(count) { this.unreadCount = count; }, // 标记全部已读 markAllAsRead() { this.unreadCount = 0; } });