# electron 模版项目 **Repository Path**: he-junyang/electron-template ## Basic Information - **Project Name**: electron 模版项目 - **Description**: electron 模块项目, 含一些基本示例 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-05-21 - **Last Updated**: 2023-05-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 1. 打开程序 注意, node_modules 千万不能删, 删了就无法打包了... 如果真的删了, 使用 `npm i` 打包, 不要用 `cnpm i` , 会丢失很多东西 ```shell cnpm i ``` ```shell cnpm start # (electron .) ``` # 2. 打包程序 注意, 路径上不能有中文字符 ```shell cnpm run make ``` # 3. 各个文件作用 index.html : 主进程渲染的模版文件, 里面可以导入其他js文件,但都会被看成渲染进程 index.js : 主文件 - 测试了主进程与渲染进程的通信 - 测试了端口通信 - 设置自定义菜单 - 设置渲染进程可以使用 nodeJs 能力, electron能力 - 加载模块 - 设置快捷键 preload.js : 预加载脚本, 若渲染进程不可以使用nodeJs能力或者electron能力, 这个脚本可以将这些功能分发出来(这个脚本可以使用electron和NodeJs) render.js : 给index.html添加附加功能, 是渲染进程,可以从@electron/remote导入electron能力