Create a project

1. Use scaffolding to create projects normally

vue create hello-world
Copy the code

2. Integrated electron

vue add vue-cli-plugin-electron-builder
Copy the code

But this step probably stuck most of you in downloading Electron this, because for all known reasons, it takes a long time

Therefore, we recommend using domestic source acceleration

npx cross-env ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/" vue add vue-cli-plugin-electron-builder
Copy the code

This way you can speed up your integration

You can also create.npMRc files in your project

# .npmrc
electron_mirror="https://npm.taobao.org/mirrors/electron/"
Copy the code

After the integration

3. Run

npm run electron:serve
Copy the code

4. Packaging

npx run electron:build
Copy the code

Macos package, need to ignore the signature, modify electron:build

{
"electron:build":"npx cross-env CSC_IDENTITY_AUTO_DISCOVERY=false vue-cli-service electron:build"
}
Copy the code