首页 > 其他 > 详细

electron 开发 - 初入

时间:2019-12-17 14:03:02      阅读:78      评论:0      收藏:0      [点我收藏+]

1、新建文件夹

 

2、 npm init 

  package.json:

{
  "name": "clock",
  "version": "1.0.0",
  "description": "clock",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "trinity",
  "license": "ISC",
  "devDependencies": {
    "electron": "^7.1.5"
  }
}

 

 

3、 npm install electron 

 

4、main.js:

const electron = require(‘electron‘)

function createWindow () {
  let win = new electron.BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  })
  win.loadFile(‘index.html‘)
}

electron.app.on(‘ready‘, createWindow)

 

5、index.html:

<h1>app running</h1>

 

6、运行 npm start :

技术分享图片

 

 

 

 

 

bingo!your first app is running now!

electron 开发 - 初入

原文:https://www.cnblogs.com/yummylucky/p/12053519.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!