前端: 修复Electron加载本地HTML问题,添加index.html入口
This commit is contained in:
parent
96855c1c43
commit
c7808b3f17
@ -14,13 +14,12 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load the app
|
// Load the app - use proper file path
|
||||||
if (process.env.NODE_ENV === 'development') {
|
const indexPath = path.join(__dirname, '../renderer/index.html');
|
||||||
mainWindow.loadURL('http://localhost:3000');
|
mainWindow.loadFile(indexPath);
|
||||||
mainWindow.webContents.openDevTools();
|
|
||||||
} else {
|
// Open DevTools in development
|
||||||
mainWindow.loadFile(path.join(__dirname, '../renderer/index.html'));
|
// mainWindow.webContents.openDevTools();
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
mainWindow.on('closed', () => {
|
||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
@ -57,7 +56,6 @@ ipcMain.handle('select-folder', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('show-message', async (event, { title, message, type }) => {
|
ipcMain.handle('show-message', async (event, { title, message, type }) => {
|
||||||
const { dialog } = require('electron');
|
|
||||||
return dialog.showMessageBox(mainWindow, {
|
return dialog.showMessageBox(mainWindow, {
|
||||||
type: type || 'info',
|
type: type || 'info',
|
||||||
title: title || 'CloudDisk',
|
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