显示加载本地文件
This commit is contained in:
@@ -1,31 +1,34 @@
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
import { join } from "path"
|
||||
|
||||
const URL = (process.env.NODE_ENV === 'development') ? 'http://localhost:3000/' : 'http://gnss.cesium.hwasmart.com/'
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
fullscreen: true,
|
||||
frame: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
preload: join(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
const win = new BrowserWindow({
|
||||
fullscreen: true,
|
||||
frame: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
preload: join(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
|
||||
win.loadURL(URL)
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
win.loadURL('http://localhost:3000/')
|
||||
win.webContents.openDevTools()
|
||||
} else {
|
||||
win.loadFile('dist/render/index.html')
|
||||
}
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user