├── .gitignore
├── .prettierrc
├── README.md
├── babel.config.js
├── package.json
├── public
├── favicon.ico
└── index.html
├── src
├── App.vue
├── assets
│ └── logo.png
├── background.js
├── components
│ ├── FilesViewer.vue
│ ├── IconFile.vue
│ ├── IconFolder.vue
│ └── IconFolderOpen.vue
└── main.js
├── vue.config.js
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
15 |
16 | # Editor directories and files
17 | .idea
18 | .vscode
19 | *.suo
20 | *.ntvs*
21 | *.njsproj
22 | *.sln
23 | *.sw?
24 |
25 | #Electron-builder output
26 | /dist_electron
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": false,
3 | "singleQuote": true,
4 | "trailingComma": "none",
5 | "arrowParens": "avoid"
6 | }
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-electron
2 |
3 | ## Project setup
4 | ```
5 | yarn install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | yarn serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | yarn build
16 | ```
17 |
18 | ### Lints and fixes files
19 | ```
20 | yarn lint
21 | ```
22 |
23 | ### Customize configuration
24 | See [Configuration Reference](https://cli.vuejs.org/config/).
25 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-electron",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint",
9 | "electron:build": "vue-cli-service electron:build",
10 | "electron:serve": "vue-cli-service electron:serve",
11 | "postinstall": "electron-builder install-app-deps",
12 | "postuninstall": "electron-builder install-app-deps"
13 | },
14 | "main": "background.js",
15 | "dependencies": {
16 | "@electron/remote": "^1.0.2",
17 | "bootstrap": "^5.0.0-beta1",
18 | "core-js": "^3.6.5",
19 | "vue": "^3.0.0"
20 | },
21 | "devDependencies": {
22 | "@vue/cli-plugin-babel": "~4.5.0",
23 | "@vue/cli-plugin-eslint": "~4.5.0",
24 | "@vue/cli-service": "~4.5.0",
25 | "@vue/compiler-sfc": "^3.0.0",
26 | "babel-eslint": "^10.1.0",
27 | "electron": "11",
28 | "electron-devtools-installer": "^3.1.0",
29 | "eslint": "^6.7.2",
30 | "eslint-plugin-vue": "^7.0.0-0",
31 | "vue-cli-plugin-electron-builder": "~2.0.0-rc.5"
32 | },
33 | "eslintConfig": {
34 | "root": true,
35 | "env": {
36 | "node": true
37 | },
38 | "extends": [
39 | "plugin:vue/vue3-essential",
40 | "eslint:recommended"
41 | ],
42 | "parserOptions": {
43 | "parser": "babel-eslint"
44 | },
45 | "rules": {}
46 | },
47 | "browserslist": [
48 | "> 1%",
49 | "last 2 versions",
50 | "not dead"
51 | ]
52 | }
53 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingwithjustin/vue3-electron/9f199a706fda54fc1db26ee6dc068b6975caab3f/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
70 |
71 |
72 |
73 |
{{ path }}
74 |
75 |
76 |
81 |
82 |
83 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingwithjustin/vue3-electron/9f199a706fda54fc1db26ee6dc068b6975caab3f/src/assets/logo.png
--------------------------------------------------------------------------------
/src/background.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | import { app, protocol, BrowserWindow } from 'electron'
4 | import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
5 | import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
6 |
7 | require('@electron/remote/main').initialize()
8 |
9 | const isDevelopment = process.env.NODE_ENV !== 'production'
10 |
11 | // Scheme must be registered before the app is ready
12 | protocol.registerSchemesAsPrivileged([
13 | { scheme: 'app', privileges: { secure: true, standard: true } }
14 | ])
15 |
16 | async function createWindow() {
17 | // Create the browser window.
18 | const win = new BrowserWindow({
19 | width: 800,
20 | height: 600,
21 | webPreferences: {
22 | // Use pluginOptions.nodeIntegration, leave this alone
23 | // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
24 | nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
25 | enableRemoteModule: true
26 | }
27 | })
28 |
29 | if (process.env.WEBPACK_DEV_SERVER_URL) {
30 | // Load the url of the dev server if in development mode
31 | await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
32 | if (!process.env.IS_TEST) win.webContents.openDevTools()
33 | } else {
34 | createProtocol('app')
35 | // Load the index.html when not in development
36 | win.loadURL('app://./index.html')
37 | }
38 | }
39 |
40 | // Quit when all windows are closed.
41 | app.on('window-all-closed', () => {
42 | // On macOS it is common for applications and their menu bar
43 | // to stay active until the user quits explicitly with Cmd + Q
44 | if (process.platform !== 'darwin') {
45 | app.quit()
46 | }
47 | })
48 |
49 | app.on('activate', () => {
50 | // On macOS it's common to re-create a window in the app when the
51 | // dock icon is clicked and there are no other windows open.
52 | if (BrowserWindow.getAllWindows().length === 0) createWindow()
53 | })
54 |
55 | // This method will be called when Electron has finished
56 | // initialization and is ready to create browser windows.
57 | // Some APIs can only be used after this event occurs.
58 | app.on('ready', async () => {
59 | if (isDevelopment && !process.env.IS_TEST) {
60 | // Install Vue Devtools
61 | try {
62 | await installExtension(VUEJS_DEVTOOLS)
63 | } catch (e) {
64 | console.error('Vue Devtools failed to install:', e.toString())
65 | }
66 | }
67 | createWindow()
68 | })
69 |
70 | // Exit cleanly on request from parent process in development mode.
71 | if (isDevelopment) {
72 | if (process.platform === 'win32') {
73 | process.on('message', data => {
74 | if (data === 'graceful-exit') {
75 | app.quit()
76 | }
77 | })
78 | } else {
79 | process.on('SIGTERM', () => {
80 | app.quit()
81 | })
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/components/FilesViewer.vue:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | |
27 | ... |
28 | |
29 |
30 |
31 |
37 |
38 |
39 |
40 | |
41 | {{ file.name }} |
42 |
43 | {{ file.size }}
44 | |
45 |
46 |
47 |
48 |
49 |
50 |
65 |
--------------------------------------------------------------------------------
/src/components/IconFile.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/src/components/IconFolder.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/src/components/IconFolderOpen.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import App from './App.vue'
3 |
4 | import 'bootstrap/dist/css/bootstrap.min.css'
5 |
6 | createApp(App).mount('#app')
7 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | pluginOptions: {
3 | electronBuilder: {
4 | nodeIntegration: true
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------