当前位置:网站首页>2. Electron's HelloWorld
2. Electron's HelloWorld
2022-04-23 17:09:00 【Curious rookie】
The official tutorial :https://www.electronjs.org/docs/latest/tutorial/quick-start
Environment building :1.Electron Development environment construction
Fast experience :
# Clone the warehouse
$ git clone https://github.com/electron/electron-quick-start
# Enter warehouse
$ cd electron-quick-start
# Install dependent libraries and run applications
$ npm install && npm start
Write your own
One 、HelloWorld Interface writing
1、 Create a new working directory :F:\study\electron\helloworld
2、 Use editor (VScode) Open the working directory and create a new one index.html file
3、 Write interface content
html:5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HelloWorld</title>
</head>
<body>
HelloWorld
</body>
</html>
Two 、 To write main.js, introduce electron Work
var electron = require('electron') // introduce electron Components
var app = electron.app // Import components app
var BrowserWindow = electron.BrowserWindow // Window reference
var mainWindow = null // Declare open window
app.on('ready', () => { //app Initialize parameters
mainWindow = new BrowserWindow({ windth: 800, height: 800 })
mainWindow.loadFile('index.html') // Open the page loaded by the window
mainWindow.on('close', () => { // When the window is closed , Release the page
mainWindow = null
})
})
3、 ... and 、 Initialize project
npm init --yes
Four 、 Run the project
electron .
Project directory structure
版权声明
本文为[Curious rookie]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231707156943.html
边栏推荐
- Clickhouse SQL operation
- El date picker limits the selection range from the current time to two months ago
- Further optimize Baidu map data visualization
- PHP efficiently reads large files and processes data
- Your brain expands and shrinks over time — these charts show how
- 自定义my_strcpy与库strcpy【模拟实现字符串相关函数】
- Detailed explanation of Milvus 2.0 quality assurance system
- Shell-awk命令的使用
- Generate random numbers with high quality and Gaussian distribution
- Preliminary understanding of promse
猜你喜欢
. net type transfer
线性代数感悟之1
Detailed explanation of Niuke - Gloves
Signalr can actively send data from the server to the client
Milvus 2.0 質量保障系統詳解
Rtklib 2.4.3 source code Notes
oracle 中快速获取表的列名列表
Detailed explanation of the penetration of network security in the shooting range
ASP. NET CORE3. 1. Solution to login failure after identity registers users
Installing labellmg tutorial in Windows
随机推荐
Shortcut keys (multiline)
Go language, array, string, slice
Linux MySQL data timing dump
Promise (II)
C# Task. Delay and thread The difference between sleep
Production environment——
Baidu Map Case - modify map style
Some problems encountered in recent programming 2021 / 9 / 8
【解决报错】Error in v-on handler: “TypeError: Cannot read property ‘resetFields’ of undefined”
ASP. Net core dependency injection service life cycle
Read a blog, re understand closures and tidy up
freeCodeCamp----shape_ Calculator exercise
C语言函数详解
Website_ Collection
Basic case of Baidu map
VsCode-Go
【题解】[SHOI2012] 随机树
EF core in ASP Generate core priority database based on net entity model
How vscode compares the similarities and differences between two files
Rtklib 2.4.3 source code Notes