无法在电子中正确渲染材料选择元素

问题描述

我是电子新手,我最近开始尝试电子,但是我遇到物化元素的某些问题。当我在浏览器中打开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>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)