From 13ae99945b3e10ab45370b979afa726c1e5da013 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 4 Mar 2024 16:41:30 +0800 Subject: [PATCH] notification click err: null --- src/lib/msgUtils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/msgUtils.js b/src/lib/msgUtils.js index fae2c67..de9f751 100644 --- a/src/lib/msgUtils.js +++ b/src/lib/msgUtils.js @@ -375,6 +375,7 @@ export const whatsappError = { * 系统弹窗通知 */ export const handleNotification = (title, _options) => { + var notification; const options = { requireInteraction: true, // 设置手动关闭 tag: 'global-sales-notification', // 通知ID,同类通知建议设置相同ID,避免通知过多遮挡桌面 @@ -384,11 +385,11 @@ export const handleNotification = (title, _options) => { // 检查用户是否同意接受通知 if (Notification.permission === 'granted') { - var notification = new Notification(title, options); + notification = new Notification(title, options); } else if (Notification.permission !== 'denied') { Notification.requestPermission().then(function (permission) { if (permission === 'granted') { - var notification = new Notification(title, options); + notification = new Notification(title, options); } }); } else {