From 79cd832cfc54b2505da3bd1f9ec435b1693bf014 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com>
Date: Mon, 31 Aug 2020 09:50:57 +0800
Subject: [PATCH] chore: upate
---
package.json | 5 ++---
src/main/index.ts | 5 ++++-
src/main/preload.js | 5 +++++
src/render/App.vue | 2 +-
src/render/index.html | 2 +-
src/render/main.js | 5 -----
src/render/main.ts | 9 +++++++++
src/render/shims.d.ts | 4 ++++
src/render/source.d.ts | 4 ++++
typings/typings.d.ts | 5 +++++
vite.config.ts | 11 ++++++++++-
11 files changed, 45 insertions(+), 12 deletions(-)
create mode 100644 src/main/preload.js
delete mode 100644 src/render/main.js
create mode 100644 src/render/main.ts
create mode 100644 src/render/shims.d.ts
create mode 100644 src/render/source.d.ts
create mode 100644 typings/typings.d.ts
diff --git a/package.json b/package.json
index 1e55b1d..5ff5e42 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "electron-vue",
"version": "0.0.1",
- "main": "src/main/_.js",
+ "main": "dist/main/_.js",
"author": "草鞋没号 <308487730@qq.com>",
"license": "MIT",
"scripts": {
@@ -17,8 +17,7 @@
"appId": "308487730@qq.com",
"files": [
"!node_modules",
- "src/main/**",
- "src/render/dist/**"
+ "dist/**"
],
"mac": {
"artifactName": "${productName}_setup_${version}.${ext}",
diff --git a/src/main/index.ts b/src/main/index.ts
index aafad94..3714c68 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -15,11 +15,14 @@ function createWin() {
win = new BrowserWindow({
width: 1024,
height: 768,
+ webPreferences: {
+ nodeIntegration: true,
+ },
})
const URL = is_dev
? `http://localhost:${process.env.PORT}` // vite 启动的服务器地址
- : `file://${join(__dirname, '../render/dist/index.html')}` // vite 构建后的静态文件地址
+ : `file://${join(__dirname, '../../dist/render/index.html')}` // vite 构建后的静态文件地址
win.loadURL(URL)
}
diff --git a/src/main/preload.js b/src/main/preload.js
new file mode 100644
index 0000000..601ee49
--- /dev/null
+++ b/src/main/preload.js
@@ -0,0 +1,5 @@
+const { ipcRenderer } = require('electron')
+
+window.stopLoading = function() {
+ ipcRenderer.send('stop-loading-main')
+}
diff --git a/src/render/App.vue b/src/render/App.vue
index 12d83b4..be70e71 100644
--- a/src/render/App.vue
+++ b/src/render/App.vue
@@ -3,7 +3,7 @@
-
+
+