You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
935 B
22 lines
935 B
import { ref, computed } from 'vue';
|
|
|
|
/**
|
|
* 消息未读数(跨 tabbar 页面共享)
|
|
* - 模块级单例,四个 tabbar 页面(首页/查询/消息/我的)共享同一份
|
|
* - 消息中心页面负责写入;其他页面仅读取用于 footer-bar 角标展示
|
|
*/
|
|
export const messageUnread = ref(0);
|
|
|
|
/** 格式化为角标展示值(0 显示空) */
|
|
export const messageUnreadBadge = computed(() => (messageUnread.value > 0 ? messageUnread.value : ''));
|
|
|
|
/** 直接设置未读总数 */
|
|
export const setMessageUnread = (count) => {
|
|
messageUnread.value = Number(count) || 0;
|
|
};
|
|
|
|
// 占位 default 导出:src/store 目录会被 globalStore.js 通过 import.meta.glob
|
|
// 以 { import: 'default' } 的方式扫描,缺少 default 会触发
|
|
// "does not provide an export named 'default'" 错误。
|
|
// 此处导出一个不带 $id 的对象,globalStore 会自动跳过注册,不影响 Pinia。
|
|
export default {};
|
|
|