25、网页引用jQuery在Electron运行出现"$ is not defined"
Electron因为开启了node集成才能实现和网页的通信,引入jQuery较高版本它的模块化定义(基于CommonJS)和Electron的内部机制冲突了。目前提供以下两个方案:
1、使用jQuery 1.8.2版本,更高版本还没有测试。
2、添加下面的代码以后,再引入jQuery的高版本。注意前后顺序
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
分类:
electron
标签:
electron
« 上一篇: 24、electron 报@electron/remote is disabled for this WebContents. Call require("@electron/remote/main").enable(webContents) to enable it.
» 下一篇: 26、electron 跨域报:has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `local`.
» 下一篇: 26、electron 跨域报:has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `local`.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现