add Notify

This commit is contained in:
Timi
2026-08-21 13:52:52 +08:00
parent 1f37d36901
commit c97913da2d
9 changed files with 803 additions and 28 deletions
+11
View File
@@ -6,6 +6,7 @@ export const useNavBarStore = defineStore("nav-bar", () => {
const title = ref("");
const backTo = ref<string>();
const rightIcon = ref("");
const rightBadge = ref<number>();
const rightText = ref("");
const rightTextColor = ref("");
const rightAction = shallowRef<(() => void | Promise<void>) | undefined>();
@@ -33,6 +34,7 @@ export const useNavBarStore = defineStore("nav-bar", () => {
function setRightIcon(value?: string, action?: () => void | Promise<void>): void {
rightIcon.value = value || "";
rightBadge.value = undefined;
rightAction.value = action;
if (value) {
rightText.value = "";
@@ -41,11 +43,16 @@ export const useNavBarStore = defineStore("nav-bar", () => {
}
}
function setRightBadge(value?: number): void {
rightBadge.value = value === undefined ? undefined : Math.max(0, value);
}
function setRightText(value?: string, color?: string, action?: () => void | Promise<void>): void {
rightText.value = value || "";
rightTextColor.value = color || "";
rightAction.value = action;
if (value) {
rightBadge.value = undefined;
rightIcon.value = "";
customRightVisible.value = false;
}
@@ -59,6 +66,7 @@ export const useNavBarStore = defineStore("nav-bar", () => {
customRightVisible.value = value;
if (value) {
rightIcon.value = "";
rightBadge.value = undefined;
rightText.value = "";
rightTextColor.value = "";
rightAction.value = undefined;
@@ -67,6 +75,7 @@ export const useNavBarStore = defineStore("nav-bar", () => {
function clearRight(): void {
rightIcon.value = "";
rightBadge.value = undefined;
rightText.value = "";
rightTextColor.value = "";
rightAction.value = undefined;
@@ -78,6 +87,7 @@ export const useNavBarStore = defineStore("nav-bar", () => {
title,
backTo,
rightIcon,
rightBadge,
rightText,
rightTextColor,
rightAction,
@@ -88,6 +98,7 @@ export const useNavBarStore = defineStore("nav-bar", () => {
setHeight,
setBackTo,
setRightIcon,
setRightBadge,
setRightText,
setCustomTitleVisible,
setCustomRightVisible,