...
大前端 electronnodejs

electron渲染进程开启node及webview权限

electron 10以上渲染进程开启node能力的配置变了

contextIsolation: false,  //是否在独立 JavaScript 环境中运行
nodeIntegration: true, //是否完整的支持 node. 默认值为false   这个要打开才能在渲染进程使用node
enableRemoteModule: true,  //是否支持远程模块
webviewTag: true,  //是否支持webwiew标签

完整窗口创建代码:

const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
        contextIsolation: false,
        nodeIntegration: true,
        enableRemoteModule: true,
        webviewTag: true,
        preload : path.join(app.getAppPath(),'preload.js')
    }
})
Electron V14 Electron Remote模块用法 CSS滚动条样式 CSS设置滚动条样式
biu biu biu
抖音直播自动点赞脚本,解放双手,从我做起 申请Let‘s Encrypt免费SSL证书、自动化续签证书 免费在线pdf文档文件翻译工具分享一下 小程序使用udp广播获取esp8266的局域网ip地址 在线免费的AI照片无损放大和模糊修复工具分享