diff --git a/electron.js b/electron.js new file mode 100644 index 0000000..16ad04c --- /dev/null +++ b/electron.js @@ -0,0 +1,15 @@ +const { app, BrowserWindow } = require('electron') + +function createWindow () { + const win = new BrowserWindow({ + width: 800, + height: 600, + webPreferences: { + nodeIntegration: true, + } + }) + + win.loadURL('http://localhost:4678/') +} + +app.whenReady().then(createWindow) \ No newline at end of file diff --git a/package.json b/package.json index 41a1b2c..895b3a4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,9 @@ "scripts": { "dev": "vite", "build": "vite build", - "serve": "vite preview" + "serve": "vite preview", + "es": "vite && electron .", + "eb": "vite build && electron-builder" }, "dependencies": { "@tailwindcss/postcss7-compat": "^2.2.4", @@ -23,6 +25,8 @@ "@vicons/antd": "^0.10.0", "@vitejs/plugin-vue": "^4.2.3", "@vue/compiler-sfc": "^3.3.4", + "electron": "^28.0.0", + "electron-builder": "^24.9.1", "naive-ui": "^2.34.4", "typescript": "^4.3.2", "vfonts": "^0.1.0", diff --git a/vite.config.ts b/vite.config.ts index e563f09..2778327 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,6 +13,8 @@ export default defineConfig({ }, server: { host: '0.0.0.0', //允许本机 + // 指定端口 + port: 4678, proxy: { // string shorthand '/mt': {