21 lines
783 B
Vue
Raw Normal View History

2025-07-30 18:25:58 +08:00
import { contextBridge, ipcRenderer } from 'electron';
import { ElectronEnum } from '../../src/enums/jeecgEnum';
2025-06-25 16:04:02 +08:00
2025-07-30 18:25:58 +08:00
contextBridge.exposeInMainWorld(ElectronEnum.ELECTRON_API, {
2025-06-25 16:04:02 +08:00
openInBrowser: (url: string) => ipcRenderer.send('open-in-browser', url),
2025-07-30 18:25:58 +08:00
// 发送消息通知
sendNotification: (title: string, body: string, path: string) => {
ipcRenderer.send('notify-with-path', { title, body, path });
},
// 绑定路由跳转
onNavigate: (cb: (path: string) => void) => {
ipcRenderer.on('navigate-to', (_, path) => cb(path));
},
// 任务栏闪
sendNotifyFlash: () => ipcRenderer.send('notify-flash'),
// 托盘闪动
trayFlash: () => ipcRenderer.send('tray-flash'),
// 托盘停止闪动
trayFlashStop: () => ipcRenderer.send('tray-flash-stop'),
2025-06-25 16:04:02 +08:00
});