Go to file
2021-11-02 15:23:29 +08:00
blog chore: UPDATE wx qrcode 2021-11-01 10:12:01 +08:00
screenshot chore: Electron@15 2021-11-02 15:07:45 +08:00
script feat: support preload script hot reload 2021-10-25 20:45:37 +08:00
src chore: Electron@15 2021-11-02 15:07:45 +08:00
typings communication declare 2021-09-09 10:17:30 +08:00
.gitignore chore: UPDATE 2021-05-30 07:50:29 +08:00
.npmrc chore: remove taobao electron_mirror 2021-07-04 18:00:36 +08:00
note.md chore: UPDATE 2021-05-30 08:24:29 +08:00
package.json chore(deps): UPDATE 2021-11-02 15:04:24 +08:00
README.md chore(docs): Communication 2021-11-02 15:23:29 +08:00
tsconfig.json chore: UPDATE 2021-09-09 09:36:06 +08:00
vite.config.ts refactor: package.json.env alternative .env 2021-10-25 20:32:16 +08:00
yarn.lock chore(deps): UPDATE 2021-11-02 15:04:24 +08:00

electron-vue-vite

🥳 Simple boilerplate.

Electron + Vue3 + Vite2 integration

Feature

  • HRM

    • Main process hot restart
    • Preload script hot reload
    • Renderer process hot module replacement -- power by Vite
  • Beautiful log

    • [R] means Renderer process
    • [P] means Preload script
    • [M] means Main process

Run Setup

# 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

Communication

  • All NodeJs、Electron API invoke passed Preload script

    • src/preload/index.ts

      // --------- Expose some API to Renderer process. ---------
      contextBridge.exposeInMainWorld('fs', fs)
      contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer)
      
    • typings/global.d.ts

      interface Window {
        fs: typeof import('fs')
        ipcRenderer: import('electron').IpcRenderer
      }
      
    • src/render/main.ts

      console.log('fs', window.fs)
      console.log('ipcRenderer', window.ipcRenderer)
      

Branchs

  • ant-design-vue
    • Use tsx
    • Integration ant-design-vue
  • element-plus 登录窗口、element-ui 这个可能很适合你 🚀
    • With multiple BrowserWindow
    • Integration element-plus

Mian window

微信讨论


License

MIT License