我用下面的方法创建了一个新的BrowserWindow,但是我的CSS不工作。如何将其应用于此窗口?
$("#btn-new-client").click(function() {
const remote = require('electron').remote;
const parent = remote.getCurrentWindow();
const BrowserWindow = remote.BrowserWindow;
const child = new BrowserWindow({
height: 400,
width: 800,
parent: parent,
modal: true
});
child.loadFile('new/client.html')
});发布于 2020-04-02 23:46:37
与普通浏览器一样,您需要在HTML文件(new/client.html)中链接样式表。假设您在同一文件夹中有一个new/styles.css文件。
<!-- inside 'new/client.html' -->
<head>
<!-- ... -->
<link rel="stylesheet" type="text/css" href="./styles.css">
<!-- ... -->
</head>在浏览器窗口的DevTools中,确保指向样式表的链接正确。
https://stackoverflow.com/questions/60994661
复制相似问题