From fe77bc8bc999e938d3b7f623c2c33cb43223003b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=AA=E5=BF=86=E5=A4=A9=E5=A0=82?= <1455668754@qq.com> Date: Mon, 13 Apr 2026 16:05:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=9A=E7=9F=A5=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8A=A0=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/layouts/basic.vue | 30 +++ apps/web-antdv-next/src/layouts/basic.vue | 30 +++ apps/web-ele/src/layouts/basic.vue | 30 +++ apps/web-naive/src/layouts/basic.vue | 29 +++ apps/web-tdesign/src/layouts/basic.vue | 30 +++ packages/@core/base/icons/src/lucide.ts | 1 + .../effects/common-ui/src/components/index.ts | 1 + .../src/widgets/notification/notification.vue | 172 ++++++++---------- .../layouts/src/widgets/notification/types.ts | 2 + playground/src/layouts/basic.vue | 29 +++ 10 files changed, 256 insertions(+), 98 deletions(-) diff --git a/apps/web-antd/src/layouts/basic.vue b/apps/web-antd/src/layouts/basic.vue index 2226c68a2..211ee7be3 100644 --- a/apps/web-antd/src/layouts/basic.vue +++ b/apps/web-antd/src/layouts/basic.vue @@ -147,6 +147,34 @@ function remove(id: number | string) { function handleMakeAll() { notifications.value.forEach((item) => (item.isRead = true)); } + +const viewAll = () => {}; + +const handleClick = (item: NotificationItem) => { + // 如果通知项有链接,点击时跳转 + if (item.link) { + navigateTo(item.link, item.query, item.state); + } +}; + +function navigateTo( + link: string, + query?: Record, + state?: Record, +) { + if (link.startsWith('http://') || link.startsWith('https://')) { + // 外部链接,在新标签页打开 + window.open(link, '_blank'); + } else { + // 内部路由链接,支持 query 参数和 state + router.push({ + path: link, + query: query || {}, + state, + }); + } +} + watch( () => ({ enable: preferences.app.watermark, @@ -189,6 +217,8 @@ watch( @read="(item) => item.id && markRead(item.id)" @remove="(item) => item.id && remove(item.id)" @make-all="handleMakeAll" + @on-click="handleClick" + @view-all="viewAll" />