【发布时间】:2020-06-15 20:37:18
【问题描述】:
我是 ElectronJs 的新手,我终于想出了如何获得圆角。
但是,现在我开始工作了,我注意到我失去了窗户上的阴影,为什么?
您可以在下面找到电子特定代码的整个 main.js 文件。
const electron = require("electron");
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const path = require("path");
const isDev = require("electron-is-dev");
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 900,
height: 680,
frame: false,
transparent: true,
hasShadow: true
});
mainWindow.loadURL(
isDev
? "http://localhost:3000"
: `file://${path.join(__dirname, "../build/index.html")}`
);
if (isDev) {
// Open the DevTools.
//BrowserWindow.addDevToolsExtension('<location to your react chrome extension>');
mainWindow.webContents.openDevTools();
}
mainWindow.on("closed", () => (mainWindow = null));
}
app.on("ready", () => {
createWindow();
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
app.on("activate", () => {
if (mainWindow === null) {
createWindow();
}
});
});
【问题讨论】:
-
阴影应该来自弹窗,我们可以看看你弹窗的代码吗?
-
@SydneyY 添加到 OP