...
大前端 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
PHP 在 Console 控制台模式下的进度显示 标准输出 打印 Navicat Premium 15破解 windows Navicat Premium 注册出现 Rsa Public Key not Find... Uninstall Tool 绿色版下载 微信网页版发送消息代码 windows cmd控制台隐藏运行