为了账号安全,请及时绑定邮箱和手机立即绑定

主进程为什么不能打印

const { ipcRenderer } = require("electron");

window.addEventListener("DOMContentLoaded", () => {

  ipcRenderer.send("message", "hello from renderer");

});



// Modules to control application life and create native browser window

const { app, BrowserWindow, ipcMain } = require("electron");


app.on("ready", () => {

  const mainwindow = new BrowserWindow({

    width: 800,

    height: 600,

    webPreferences: {

      //在应用中 可以使用 nodeJs 的API

      nodeIntegration: true

    }

  });

  mainwindow.loadFile("index.html");

  ipcMain.on("message", (event, arg) => {

    console.log(arg);

  });

});



正在回答

1 回答

http://img1.sycdn.imooc.com//6098178200010cec03820171.jpg
加这个试试

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

主进程为什么不能打印

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号