前端: 修复Electron加载本地HTML问题,添加index.html入口
This commit is contained in:
parent
96855c1c43
commit
c7808b3f17
@ -14,13 +14,12 @@ function createWindow() {
|
||||
}
|
||||
});
|
||||
|
||||
// Load the app
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
mainWindow.loadURL('http://localhost:3000');
|
||||
mainWindow.webContents.openDevTools();
|
||||
} else {
|
||||
mainWindow.loadFile(path.join(__dirname, '../renderer/index.html'));
|
||||
}
|
||||
// Load the app - use proper file path
|
||||
const indexPath = path.join(__dirname, '../renderer/index.html');
|
||||
mainWindow.loadFile(indexPath);
|
||||
|
||||
// Open DevTools in development
|
||||
// mainWindow.webContents.openDevTools();
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null;
|
||||
@ -57,7 +56,6 @@ ipcMain.handle('select-folder', async () => {
|
||||
});
|
||||
|
||||
ipcMain.handle('show-message', async (event, { title, message, type }) => {
|
||||
const { dialog } = require('electron');
|
||||
return dialog.showMessageBox(mainWindow, {
|
||||
type: type || 'info',
|
||||
title: title || 'CloudDisk',
|
||||
|
||||
12
frontend/src/renderer/index.html
Normal file
12
frontend/src/renderer/index.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>CloudDisk</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="./renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user