-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Help] 怎么实现多个preload文件呢 #501
Labels
help wanted
Extra attention is needed
Comments
我也卡在这个问题里 |
const { app, BrowserWindow } = require('electron');
const path = require('path');
function createWindow1() {
const win1 = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload1.js')
}
});
win1.loadFile('index1.html');
}
function createWindow2() {
const win2 = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload2.js')
}
});
win2.loadFile('index2.html');
}
app.whenReady().then(() => {
createWindow1();
createWindow2();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow1();
createWindow2();
}
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
}); 类似这样可以解决您的问题吗? |
注意需要你创建两个 index.html 入口文件 |
请问一下这个问题解决了吗,vite.config.ts 是怎么配置的可以参考一下吗 |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我希望不同的窗口能够加载不同的preload,所以需要多个preload,目前有办法实现吗
The text was updated successfully, but these errors were encountered: