This commit is contained in:
parent
3ebe62e589
commit
c7811b64b4
16
main.js
16
main.js
|
|
@ -17,6 +17,7 @@ const cancellationToken = new CancellationToken()
|
|||
app.allowRendererProcessReuse = false;
|
||||
let mainWindow = null;
|
||||
let isMaximized = false;
|
||||
let env;
|
||||
|
||||
class AppWindow extends BrowserWindow {
|
||||
constructor(config) {
|
||||
|
|
@ -36,7 +37,6 @@ class AppWindow extends BrowserWindow {
|
|||
};
|
||||
const finalConfig = { ...basicConfig, ...config };
|
||||
super(finalConfig);
|
||||
const env = process.argv.find((arg) => arg.startsWith('--env='))?.split('=')[1];
|
||||
if (env === 'development') {
|
||||
// 开发
|
||||
this.loadURL('http://localhost:3000');
|
||||
|
|
@ -123,7 +123,7 @@ app.on('will-quit', async (event) => {
|
|||
});
|
||||
|
||||
app.on('ready', () => {
|
||||
const env = process.argv.find((arg) => arg.startsWith('--env='))?.split('=')[1];
|
||||
env = process.argv.find((arg) => arg.startsWith('--env='))?.split('=')[1];
|
||||
if (env === 'development') {
|
||||
Object.defineProperty(app, 'isPackaged', {
|
||||
get() {
|
||||
|
|
@ -146,8 +146,10 @@ app.on('ready', () => {
|
|||
}
|
||||
// 监听f12打开控制台
|
||||
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.key === 'F12') {
|
||||
mainWindow.webContents.openDevTools()
|
||||
if (env === 'development') {
|
||||
if (input.key === 'F12') {
|
||||
mainWindow.webContents.openDevTools()
|
||||
}
|
||||
}
|
||||
});
|
||||
// 监听移动
|
||||
|
|
@ -282,8 +284,10 @@ app.on('ready', () => {
|
|||
});
|
||||
newWindow.loadURL(data.url);
|
||||
newWindow.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.key === 'F12') {
|
||||
newWindow.webContents.openDevTools()
|
||||
if (env === 'development') {
|
||||
if (input.key === 'F12') {
|
||||
newWindow.webContents.openDevTools()
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "multi.person.meeting",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.1",
|
||||
"main": "main.js",
|
||||
"authors": "yj",
|
||||
"description": "test",
|
||||
|
|
|
|||
15
src/App.tsx
15
src/App.tsx
|
|
@ -153,16 +153,11 @@ const App: React.FC = () => {
|
|||
}, [navigate])
|
||||
}
|
||||
useEffect(() => {
|
||||
if (import.meta.env.VITE_ENV !== 'development') {
|
||||
document.addEventListener('keydown', (event) => {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key === 'r') {
|
||||
event.preventDefault();
|
||||
}
|
||||
if (event.key === 'F11') {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
document.addEventListener('keydown', (event) => {
|
||||
if (event.key === 'F11') {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}, [])
|
||||
const handleResize = (): void => {
|
||||
setWindowSize({
|
||||
|
|
|
|||
Loading…
Reference in New Issue