fix: 修复新建项目无响应问题
- 替换 prompt() 为 InputDialog Vue 模态组件 - 替换 alert()/confirm() 为 Electron showMessageBox IPC - 添加 dialog:showMessage / dialog:showConfirm IPC 通道
This commit is contained in:
@@ -85,6 +85,28 @@ ipcMain.handle('dialog:saveFile', async (_event, options) => {
|
||||
return null
|
||||
})
|
||||
|
||||
ipcMain.handle('dialog:showMessage', async (_event, options) => {
|
||||
const result = await dialog.showMessageBox(mainWindow, {
|
||||
type: options?.type || 'info',
|
||||
buttons: options?.buttons || ['确定'],
|
||||
title: options?.title || 'Web2App',
|
||||
message: options?.message || ''
|
||||
})
|
||||
return result.response
|
||||
})
|
||||
|
||||
ipcMain.handle('dialog:showConfirm', async (_event, options) => {
|
||||
const result = await dialog.showMessageBox(mainWindow, {
|
||||
type: 'question',
|
||||
buttons: ['取消', '确定'],
|
||||
defaultId: 1,
|
||||
cancelId: 0,
|
||||
title: options?.title || 'Web2App',
|
||||
message: options?.message || '确认?'
|
||||
})
|
||||
return result.response === 1
|
||||
})
|
||||
|
||||
ipcMain.handle('dir:readTree', async (_event, dirPath) => {
|
||||
return readDirectoryTree(dirPath)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user