我是电子新手,我最近开始尝试电子,但是我遇到物化元素的某些问题。当我在浏览器中打开HTML文件时,select元素已正确呈现,但是当我通过电子运行HTML文件时,electron rendering of the select element不能正确呈现。以下文件分别是main.js和index.html。请帮助我解决此问题。
const path = require("path");
const os = require("os");
const {
app,
BrowserWindow,
} = require("electron");
require("electron-reload")(__dirname);
let window;
function createWindow() {
window = new BrowserWindow({
title: "App",
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
},
});
window.loadFile("index.html");
}
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
app.on("ready", createWindow);
app.disableHardwareAcceleration();
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.4/css/materialize.min.css">
<title>App</title>
</head>
<body>
<div class="container">
<div class="input-field col s12">
<select>
<option value="" disabled selected>What do you think?</option>
<option value="yes">Yes</option>
<option value="no">No</option>
<option value="dont">I Don't Know</option>
</select>
<label>A Demo of Material Select</label>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.4/js/materialize.min.js"></script>
<script>
(function($){
$(function(){
// Plugin initialization
$('select').not('.disabled').formSelect();
});
})(jQuery); // end of jQuery name space
</script>
</div>
</body>
</html>