From bc8ee604fbbd024e0b4e3db5eb0f4b5897a4ca40 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 14 Jan 2026 14:55:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(notification):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=BD=BF=E7=94=A8title=E5=B1=9E=E6=80=A7=E6=9B=BF=E4=BB=A3mess?= =?UTF-8?q?age=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 将notification的message属性替换为title属性以保持一致性 feat: 在登录成功时添加新的notification样式演示 docs: 添加antdv-next替换ant-design-vue的提示 --- apps/web-antd/src/components/tree/src/helper.tsx | 4 ++-- apps/web-antd/src/store/auth.ts | 12 +++++++++++- apps/web-antd/src/store/notify.ts | 4 +++- .../web-antd/src/views/dashboard/analytics/index.vue | 9 +++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/web-antd/src/components/tree/src/helper.tsx b/apps/web-antd/src/components/tree/src/helper.tsx index 9e609dd3..ff700a98 100644 --- a/apps/web-antd/src/components/tree/src/helper.tsx +++ b/apps/web-antd/src/components/tree/src/helper.tsx @@ -155,7 +155,7 @@ function validateMenuTree(menu: MenuOption) { const description = `错误用法: [${menu.label} - 菜单]下不能放 目录/菜单 -> [${item.label}]`; console.warn(description); notification.warning({ - message: '提示', + title: '提示', description, duration: 0, }); @@ -172,7 +172,7 @@ function validateMenuTree(menu: MenuOption) { const description = `错误用法: [${menu.label} - 按钮]下不能放置'目录/菜单/按钮' -> [${item.label}]`; console.warn(description); notification.warning({ - message: '提示', + title: '提示', description, duration: 0, }); diff --git a/apps/web-antd/src/store/auth.ts b/apps/web-antd/src/store/auth.ts index eeac82f0..9e2c567d 100644 --- a/apps/web-antd/src/store/auth.ts +++ b/apps/web-antd/src/store/auth.ts @@ -69,7 +69,17 @@ export const useAuthStore = defineStore('auth', () => { notification.success({ description: `${$t('authentication.loginSuccessDesc')}:${userInfo?.realName}`, duration: 3, - message: $t('authentication.loginSuccess'), + title: $t('authentication.loginSuccess'), + }); + + await new Promise((resolve) => setTimeout(resolve, 1000)); + Array.from({ length: 5 }).forEach((_, index) => { + setTimeout(() => { + notification.success({ + title: '新的notification样式', + description: '这是一条新的通知消息', + }); + }, index * 900); }); } } finally { diff --git a/apps/web-antd/src/store/notify.ts b/apps/web-antd/src/store/notify.ts index b5f5814f..52a9429f 100644 --- a/apps/web-antd/src/store/notify.ts +++ b/apps/web-antd/src/store/notify.ts @@ -5,6 +5,7 @@ import { computed, ref, watch } from 'vue'; import { SvgMessageUrl } from '@vben/icons'; import { $t } from '@vben/locales'; import { useUserStore } from '@vben/stores'; +import { buildUUID } from '@vben/utils'; import { Modal, notification } from 'antdv-next'; import dayjs from 'dayjs'; @@ -55,7 +56,7 @@ export const useNotifyStore = defineStore( notification.success({ description: message, duration: 3, - message: $t('component.notice.received'), + title: $t('component.notice.received'), }); notificationList.value.unshift({ @@ -66,6 +67,7 @@ export const useNotifyStore = defineStore( message, title: $t('component.notice.title'), userId: userId.value, + id: buildUUID(), }); // 需要手动置空 vue3在值相同时不会触发watch diff --git a/apps/web-antd/src/views/dashboard/analytics/index.vue b/apps/web-antd/src/views/dashboard/analytics/index.vue index 5e3d6d28..00c20a08 100644 --- a/apps/web-antd/src/views/dashboard/analytics/index.vue +++ b/apps/web-antd/src/views/dashboard/analytics/index.vue @@ -14,6 +14,8 @@ import { SvgDownloadIcon, } from '@vben/icons'; +import { Alert } from 'antdv-next'; + import AnalyticsTrends from './analytics-trends.vue'; import AnalyticsVisitsData from './analytics-visits-data.vue'; import AnalyticsVisitsSales from './analytics-visits-sales.vue'; @@ -65,6 +67,13 @@ const chartTabs: TabOption[] = [