哪里有electron的最新教程呀?我在bilibili,百度上搜索发现都是比较早的教程,在youtube上搜索发现教程都更早,哪里有最近的electron的教程?electron现在没人用了吗?
我的项目目录如下: "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241008/6c699567a32426e12500782597886a7f.png) 其余 electron 为应用 main.js 主进程存放目录,dist、dist-electron 分别为 vue 的打包目录和 electron 的打包目录 之前我都是将 dist 上传到服务器,后 electron 中通过访问网络地址进行展示操作 但如今客户要求应用本地化,应该怎么做呢? 是将 electron 中的 "mainWindow.loadURL()" 指向本地 dist 文件? 还是在 electron 中开启本地 http 服务,之后服务指向本地 dist 文件? 而且我现在是打包的两个文件,是否是将 dist 复制到 electron 文件夹后,在进行应用打包? 我有点想不明白,还望指点迷津,谢谢! *** 我已通过上面提到的第三种方式成功打包,并正常显示,但是原点击功能失效在点击时候报错 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241008/7a4e518fa7db60fdd8d7daf670c647fe.png)
安装electron时提示这个是什么问题? "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241013/5aacc6eb8e9d3d5066b162ba9f53f53b.png)
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240930/75bebefa82b9d99982769f3799564861.png) "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240930/1ebebcc33f3e4792d5d329dcff46ce58.png) node-v 16.20.2 npm-v 8.19.4 npm i 直接报错 用的 npm install --legacy-peer-deps 执行的
我在做一个需求,是需要从 electron 后台获取到 html 路径,之后动态创建 iframe 插入到编辑器 目前代码如下: ipcRenderer.on("h5-iframe", (event, arg) => { let iframe = document.createElement('iframe'); iframe.src = arg; iframe.width = '100%'; iframe.src = arg console.log(1, iframe.contentDocument) // 1 null console.log(2, iframe.document) // 2 undefined iframe.addEventListener('load', (event) => { console.log(3, iframe.contentDocument) console.log(4, iframe.document) }) iframe.onload = function () { console.log(5, iframe.contentDocument) console.log(6, iframe.document) } let div = document.createElement('div'); div.appendChild(iframe); let iframeHtml = div.innerHTML; tinymce .get(tinymceId.value) .execCommand( "mceInsertContent", false, iframeHtml ); }); 但得到的结果是如下,导致无法获取内容计算高度 "console.log(1, iframe.contentDocument)" 为 "null" "console.log(2, iframe.document)" 为 "undefined" "frame.addEventListener('load', (event) => {})" 和 "iframe.onload = function () {}" 均无任何反馈 已知 "arg" 可以正确返回, 且页面可以正常插入显示,所以应该也不是跨域问题 *** 请问如何解决?万分感谢!
最近在用electron-vite创建的项目中,使用路径别名"import { BookInfo } from '@interface/book'"导入类型时,一直报错"Vue: Cannot find module @interface/book or its corresponding type declarations.",改成"import { BookInfo } from '../../../interface/book'"就正常了,写成"@/interface/book"也不行,虽然运行正常但是一直提示这个错误,用的时"webstorm",换了vscode就不报错了。 想问下是"webstorm"的问题吗,还是我哪里的设置有问题 当我把主进程里的改为"'@/interface/book'"时,运行报错了,但是渲染进程的vue文件里改了就可以正常运行 这是我的"tsconfig.node.ts" { "extends": "@electron-toolkit/tsconfig/tsconfig.node.json", "include": [ "electron.vite.config.*", "src/main/**/*", "src/preload/**/*", "src/interface/*", "src/config/*" ], "compilerOptions": { "composite": true, "types": [ "electron-vite/node" ], "baseUrl": ".", "paths": { "@/*": ["src/*"], "@interface/*": ["src/interface/*"], "@config/*": ["src/config/*"] }, } }
目标是"electron"与"go服务程序"的互相通信 比如用go处理一些文件,通过"grpc"通信在界面上显示进度 目前我已跑通官网的示例: "https://grpc.io/docs/languages/go/quickstart/" (https://link.segmentfault.com/?enc=B21mpffu%2B0%2FWRFIYEjzGBg%3D%3D.hNGuWUvZcnaBLzSbBEFg2IdHlW0CkNquddox4HdBNJ3AC5xF5ismbqs%2FGxdsCElM) 但有几个问题不是很明朗: * 互相通信是不是需要go与node各开一个服务端与客户端? * 我不能跳过node直接做到go与electron通信是吗? * 我不是纯web,所以我不需要"grpc-web"这个库对吗? 我不清楚自己是否理解正确,希望指点一二,谢谢!