electron-vite-vue/README.md

82 lines
2.3 KiB
Markdown
Raw Normal View History

2020-08-16 12:49:24 +08:00
# electron-vue-vite
2021-11-04 14:28:22 +08:00
2021-11-04 14:30:32 +08:00
![GitHub stars](https://img.shields.io/github/stars/caoxiemeihao/electron-vue-vite?color=fa6470&style=flat)
![GitHub forks](https://img.shields.io/github/forks/caoxiemeihao/electron-vue-vite?style=flat)
![GitHub issues](https://img.shields.io/github/issues/caoxiemeihao/electron-vue-vite?style=flat)
![GitHub license](https://img.shields.io/github/license/caoxiemeihao/electron-vue-vite?style=flat)
2021-11-04 14:28:22 +08:00
2021-11-02 10:33:58 +08:00
🥳 Simple boilerplate.
2021-11-02 10:32:34 +08:00
2021-03-30 09:57:22 +08:00
`Electron` + `Vue3` + `Vite2` integration
2020-08-16 20:42:52 +08:00
2021-10-25 20:18:17 +08:00
## Feature
2021-11-02 10:32:34 +08:00
- HRM
* `Main process` hot restart
* `Preload script` hot reload
* `Renderer process` hot module replacement -- power by Vite
2021-11-04 19:15:07 +08:00
- Beautiful log -- power by concurrently
2021-11-02 10:32:34 +08:00
* `[R]` means `Renderer process`
* `[P]` means `Preload script`
* `[M]` means `Main process`
<img width="900px" src="https://raw.githubusercontent.com/caoxiemeihao/electron-vue-vite/main/screenshot/better-log.png" />
2021-10-25 20:18:17 +08:00
2021-11-02 15:06:09 +08:00
## Run Setup
```bash
# clone the project
git clone git@github.com:caoxiemeihao/electron-vue-vite.git
# enter the project directory
cd electron-vue-vite
# install dependency(Recommend use yarn)
yarn
# develop
yarn dev
```
2020-08-16 21:00:37 +08:00
2021-09-09 10:01:48 +08:00
## Communication
2021-10-25 20:18:17 +08:00
- All NodeJs、Electron API invoke passed `Preload script`
2021-09-09 10:01:48 +08:00
2021-11-02 15:23:29 +08:00
* **src/preload/index.ts**
```typescript
// --------- Expose some API to Renderer process. ---------
contextBridge.exposeInMainWorld('fs', fs)
contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer)
```
* **typings/global.d.ts**
```typescript
interface Window {
fs: typeof import('fs')
ipcRenderer: import('electron').IpcRenderer
}
```
* **src/render/main.ts**
```typescript
console.log('fs', window.fs)
console.log('ipcRenderer', window.ipcRenderer)
```
2021-09-09 10:01:48 +08:00
## Branchs
- [ant-design-vue](https://github.com/caoxiemeihao/electron-vue-vite/tree/ant-design-vue)
* [x] Use tsx
2021-09-28 10:31:20 +08:00
* [x] Integration ant-design-vue
2021-10-09 16:51:31 +08:00
- [element-plus](https://github.com/caoxiemeihao/electron-vue-vite/tree/element-plus) `登录窗口、element-ui 这个可能很适合你` 🚀
2021-10-09 14:37:51 +08:00
* [x] With multiple BrowserWindow
* [x] Integration element-plus
2021-05-08 17:29:38 +08:00
2021-11-02 15:06:09 +08:00
## Mian window
<img width="700px" src="https://raw.githubusercontent.com/caoxiemeihao/electron-vue-vite/main/screenshot/electron-15.png" />
2021-11-06 22:31:12 +08:00
## Wechat group
2021-06-20 19:10:27 +08:00
2021-11-06 22:31:12 +08:00
<img width="244px" src="https://raw.githubusercontent.com/caoxiemeihao/blog/main/assets/wechat/group/qrcode.jpg" />