亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

jQuery 無法與 SemanticUI 和 Electron.js 一起使用

jQuery 無法與 SemanticUI 和 Electron.js 一起使用

一只甜甜圈 2023-09-25 16:44:43
我一直在嘗試在 Electron 應用程序的 HTML 中使用語義 UI。我可以加載元素,但由于某種原因無法使用 jQuery。我已經嘗試了本地 jQuery 副本:<script src="node_modules/jquery/dist/jquery.min.js"></script>和 CDN 版本:<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>但似乎都不起作用。我嘗試過用 jQuery 做一些簡單的事情,但仍然不起作用。任何幫助,將不勝感激。我更愿意使用我的本地副本。<!DOCTYPE html><html>   <head>      <meta charset="utf-8">      <title>Title</title>      <link rel="stylesheet" type="text/css" href="semantic/dist/semantic.min.css">      <!-- <script src="node_modules/jquery/dist/jquery.min.js"></script> -->      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>   </head>   <body>      <div class="ui sidebar inverted vertical menu">         <a class="item">1</a>      </div>      <div class="pusher">         <h1 class="asdf" id="asdf">Hello</h1>      </div>      <script>         document.getElementById("asdf").innerHTML = "new1";         $('#asdf').text("new2");         $('#asdf').html("new2");      </script>      <script src="semantic/dist/semantic.min.js"></script>   </body></html>
查看完整描述

1 回答

?
喵喔喔

TA貢獻1735條經驗 獲得超5個贊

在你的index.html


  <head>

    <script>

      window.$ = window.jQuery = require("jquery");

    </script>

    ....

并createBrowerWindow在nodeIntegration你的main.js.


const mainWindow = new BrowserWindow({

    width: 800,

    height: 600,

    webPreferences: {

      nodeIntegration: true

    }

  })


查看完整回答
反對 回復 2023-09-25
  • 1 回答
  • 0 關注
  • 141 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號