添加供应商URL可点击功能:支持在默认浏览器中打开链接

This commit is contained in:
farion1231
2025-08-06 09:56:27 +08:00
parent b83652a162
commit 4540ad613f
5 changed files with 47 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
import { app, BrowserWindow, ipcMain, dialog } from 'electron'
import { app, BrowserWindow, ipcMain, dialog, shell } from 'electron'
import path from 'path'
import Store from 'electron-store'
import { Provider, AppConfig } from '../shared/types'
@@ -133,4 +133,14 @@ ipcMain.handle('checkStatus', async (_, provider: Provider) => {
console.error('检查供应商状态失败:', error)
return false
}
})
ipcMain.handle('openExternal', async (_, url: string) => {
try {
await shell.openExternal(url)
return true
} catch (error) {
console.error('打开外部链接失败:', error)
return false
}
})