Skip to content

Commit 10363ea

Browse files
committed
update
1 parent 2ee83a4 commit 10363ea

File tree

9 files changed

+75
-50
lines changed

9 files changed

+75
-50
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![bigLogo](http://otsu.fun/big_logo.png)
22
# 🔥vue-cli-electron-template
3-
⭐Using `vue-cli3` and `Electron6` built a modular desktop application template. Convenient packaging and program language switching, with a custom borderless window, including `vue-router`, `vue-i18n`, `axios` and more common components, as well as some demo functions.
3+
⭐Using `vue-cli 3` and `Electron 8` built a modular desktop application template. Convenient packaging and program language switching, with a custom borderless window, including `vue-router`, `vue-i18n`, `axios`, `electron-builder` and more common components, as well as some demo functions.
44

55
![npm](https://img.shields.io/npm/v/@vue/cli?color=aa&label=vue-cli)
66
![GitHub package.json version](https://img.shields.io/github/package-json/v/Pure-Peace/vue-cli-electron-template?color=yellow&logo=yellow&logoColor=yellow)
@@ -15,7 +15,7 @@
1515

1616
<h2 align="center">⚡-Introduction-</h2>
1717

18-
🚀Build with `vue-cli` & `electron-builder`, modular design. added common plugins and demo features. You can happily use the `svg` icon in this project, use the `i18n` multi-language comfortably, switch the application language (overall! including the native menu of the electron and the browser page), Quickly manage multiple windows and menus, make network requests more convenient.
18+
🚀A lightweight, modular template. Added common plugins and demo features. You can happily use the `svg` icon in this project, use the `i18n` multi-language comfortably, switch the application language (including the native components and the browser page), make network requests more convenient.
1919

2020
[Document](https://github.com/Pure-Peace/vue-cli-electron-template/wiki)
2121

@@ -32,7 +32,7 @@
3232
- 🎨Modular design with object-oriented writing (mainProcess)
3333
- 🍰Language switching for the entire program
3434
- 🐳An svg component based on `svg-sprite-loader`
35-
- 🏀`Electron6`: Demo of some apis.
35+
- 🏀`Electron 8`: Demo of some apis.
3636
- 🍉`vue-i18n`: Added demonstration of language switching, including language switching effect of `electron` native menu.
3737
- 🍩`axios`: Added request demo.
3838
- 🌼Use `ESlint` for code style specification.
@@ -49,6 +49,7 @@
4949

5050
<h2 align="center">🏆-Start-</h2>
5151

52+
- `&` = `or`
5253

5354
1. **🍬Clone this repository**
5455

@@ -101,6 +102,14 @@ yarn packapp & npm run packapp
101102
- 🙉`src/mainProcess/windows`: windows and windows manager.
102103

103104
---
104-
**🔞postscript:**
105+
## 🌹Thanks
105106

106-
🌹Beginner electron, any suggestion is appreciated.
107+
108+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
109+
<!-- prettier-ignore -->
110+
| [<img src="https://avatars0.githubusercontent.com/u/1502581?&v=4" width="100px;" alt="Hancel Lin"/><br /><sub><b>Hancel Lin</b></sub>](https://github.com/imlinhanchao)<br /> |
111+
| :---: |
112+
113+
<!-- ALL-CONTRIBUTORS-LIST:END -->
114+
115+
🌺Welcome your suggestions.

README_ZH.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![bigLogo](http://otsu.fun/big_logo.png)
22
# 🔥vue-cli-electron-template
3-
⭐使用`vue-cli3``Electron6`构建的一个模块化的桌面应用程序模板。可以方便进行的打包、切换程序语言,使用自定义无边框窗口,并且添加了`vue-router``vue-i18n``axios`等等常用插件,还提供了一些演示功能
3+
⭐使用`vue-cli 3``Electron 8`构建的模块化的桌面应用程序模板。可以方便进行的打包、切换程序语言,使用自定义无边框窗口,并且添加了`vue-router``vue-i18n``axios``electron-builder`等常用插件以及一些演示功能
44

55
![npm](https://img.shields.io/npm/v/@vue/cli?color=aa&label=vue-cli)
66
![GitHub package.json version](https://img.shields.io/github/package-json/v/Pure-Peace/vue-cli-electron-template?color=yellow&logo=yellow&logoColor=yellow)
@@ -15,7 +15,7 @@
1515

1616
<h2 align="center">⚡-介绍!-</h2>
1717

18-
🚀构建于`vue-cli` & `electron-builder`,模块化设计。添加了常用插件及演示功能你可以在本项目中愉快的使用`svg`图片,舒适的享受`i18n`多国语言支持, 切换程序语言(整个程序!包括electron原生菜单及浏览器页面),快速进行多窗口管理、菜单管理,并且具有一个方便快捷的网络请求方式。
18+
🚀轻量、模块化的模板。添加了常用插件及演示功能你可以在本项目中愉快的使用`svg`图片,舒适的享受`i18n`多国语言支持,切换程序语言(包括原生组件及浏览器页面),并且具有一个方便快捷的网络请求方式。
1919

2020
[Document文档](https://github.com/Pure-Peace/vue-cli-electron-template/wiki)
2121

@@ -29,10 +29,10 @@
2929

3030
## 🔍以及:
3131
- ⛅自定义的原生无边框窗口
32-
- 🎨使用面向对象的模块化写法(主进程文件)
32+
- 🎨主进程可进行模块化管理
3333
- 🍰整个程序都可以进行方便的语言切换
3434
- 🐳一个方便你使用`svg`图片的组件(基于`svg-sprite-loader`插件)
35-
- 🏀`Electron6`:添加了一些api演示
35+
- 🏀`Electron 8`:添加了一些api演示
3636
- 🍉`vue-i18n`:添加了语言切换演示,包括`electron`原生菜单
3737
- 🍩`axios`:添加了网络请求演示
3838
- 🌼使用`ESlint`进行代码风格规范
@@ -52,6 +52,8 @@
5252

5353

5454
1. **🍬克隆这个仓库**
55+
56+
- `&` = ``
5557

5658
```bash
5759
git clone https://github.com/Pure-Peace/vue-cli-electron-template
@@ -69,7 +71,6 @@ cd vue-cli-electron-template
6971
yarn 或 npm install
7072
````
7173

72-
7374
4. **🌽启动应用**
7475

7576
```bash
@@ -103,7 +104,14 @@ yarn packapp 或 npm run packapp
103104
- 🙉`src/mainProcess/windows`:多窗口及窗口管理器
104105

105106
---
106-
**🔞后记:**
107+
## 🌹特别感谢
108+
109+
110+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
111+
<!-- prettier-ignore -->
112+
| [<img src="https://avatars0.githubusercontent.com/u/1502581?&v=4" width="100px;" alt="Hancel Lin"/><br /><sub><b>Hancel Lin</b></sub>](https://github.com/imlinhanchao)<br /> |
113+
| :---: |
107114

108-
🌹初学electron,欢迎提建议……
115+
<!-- ALL-CONTRIBUTORS-LIST:END -->
109116

117+
🌺欢迎您提出建议

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-electron-template",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
@@ -16,29 +16,29 @@
1616
"core-js": "^3.6.4",
1717
"svg-sprite-loader": "^4.2.1",
1818
"vue": "^2.6.11",
19-
"vue-i18n": "^8.0.0",
20-
"vue-router": "^3.1.5",
21-
"vuex": "^3.1.2"
19+
"vue-i18n": "^8.15.5",
20+
"vue-router": "^3.1.6",
21+
"vuex": "^3.1.3"
2222
},
2323
"devDependencies": {
24-
"@kazupon/vue-i18n-loader": "^0.3.0",
25-
"@vue/cli-plugin-babel": "~4.2.0",
26-
"@vue/cli-plugin-eslint": "~4.2.0",
27-
"@vue/cli-plugin-router": "~4.2.0",
28-
"@vue/cli-plugin-vuex": "~4.2.0",
29-
"@vue/cli-service": "~4.2.0",
30-
"@vue/eslint-config-standard": "^5.1.0",
31-
"axios": "^0.18.0",
32-
"babel-eslint": "^10.0.3",
33-
"electron": "^6.0.0",
24+
"@intlify/vue-i18n-loader": "^0.6.1",
25+
"@vue/cli-plugin-babel": "~4.2.3",
26+
"@vue/cli-plugin-eslint": "~4.2.3",
27+
"@vue/cli-plugin-router": "~4.2.3",
28+
"@vue/cli-plugin-vuex": "~4.2.3",
29+
"@vue/cli-service": "~4.2.3",
30+
"@vue/eslint-config-standard": "^5.1.2",
31+
"axios": "^0.19.2",
32+
"babel-eslint": "^10.1.0",
33+
"electron": "^8.1.1",
3434
"electron-log": "^4.1.0",
35-
"eslint": "^6.7.2",
35+
"eslint": "^6.8.0",
3636
"eslint-plugin-import": "^2.20.1",
3737
"eslint-plugin-node": "^11.0.0",
3838
"eslint-plugin-promise": "^4.2.1",
39-
"eslint-plugin-standard": "^4.0.0",
40-
"eslint-plugin-vue": "^6.1.2",
41-
"less": "^3.0.4",
39+
"eslint-plugin-standard": "^4.0.1",
40+
"eslint-plugin-vue": "^6.2.2",
41+
"less": "^3.11.1",
4242
"less-loader": "^5.0.0",
4343
"vue-cli-plugin-axios": "~0.0.4",
4444
"vue-cli-plugin-electron-builder": "~1.4.6",

src/background.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ import AppManager from './mainProcess/appManager'
1010
// Scheme must be registered before the app is ready
1111
protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: true, standard: true } }])
1212

13-
export default AppManager
13+
const app = new AppManager()
14+
15+
export default app

src/mainProcess/appManager.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Tray } from 'electron'
22

3-
import EventManager from './events/eventsManager'
4-
5-
import WindowManager from './windows/windowsManager'
3+
// management
4+
import EventManager from './events'
5+
import WindowManager from './windows'
66
import MenuManager from './menus'
77

8+
// plugins
89
import Translator from './plugins/translator'
910

1011
class AppManager {
@@ -14,15 +15,15 @@ class AppManager {
1415

1516
// 窗口管理器,主要负责管理、创建窗口
1617
// Window manager, mainly responsible for managing and creating windows
17-
this.windowManager = new WindowManager()
18+
this.windowManager = new WindowManager(this)
1819

1920
// 菜单管理器,主要负责获取菜单对象
2021
// Menu manager, mainly responsible for get the menu object
2122
this.menuManager = new MenuManager(this)
2223

2324
// 事件管理器,主要负责初始化ipc、app事件
2425
// Event manager, mainly responsible for initializing ipc, app events
25-
EventManager.initEvents(this)
26+
this.eventManager = new EventManager(this)
2627
}
2728

2829
// 初始化app,创建窗口及托盘
@@ -57,4 +58,4 @@ class AppManager {
5758
}
5859
}
5960

60-
export default new AppManager()
61+
export default AppManager

src/mainProcess/events/app/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AppEvents {
2222

2323
// app退出之前
2424
app.on('before-quit', () => {
25-
windowManager.mainWindow.tray.destroy()
25+
appManager.tray.destroy()
2626
})
2727

2828
// 所有窗口都被关闭

src/mainProcess/events/eventsManager.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/mainProcess/events/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import app from './app'
2+
import ipc from './ipc'
3+
4+
class EventManager {
5+
// 创建app、ipc事件
6+
constructor (appManager) {
7+
this.appManager = appManager
8+
this.init()
9+
}
10+
11+
init () {
12+
app.create(this.appManager)
13+
ipc.create(this.appManager)
14+
}
15+
}
16+
17+
export default EventManager
File renamed without changes.

0 commit comments

Comments
 (0)