npm run dev:all :)
This commit is contained in:
15
src/App.vue
15
src/App.vue
@@ -1,15 +0,0 @@
|
||||
<template>
|
||||
<img alt="Vue logo" src="./assets/logo.png" />
|
||||
<HelloWorld msg="Hello Vue 3.0 + Vite" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HelloWorld from './components/HelloWorld.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
HelloWorld
|
||||
}
|
||||
}
|
||||
</script>
|
||||
27
src/main/index.ts
Normal file
27
src/main/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* electron 主文件
|
||||
*/
|
||||
import { join } from 'path'
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
import is_dev from 'electron-is-dev'
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
dotenv.config({ path: join(__dirname, '../../.env') })
|
||||
|
||||
let win = null
|
||||
|
||||
function createWin() {
|
||||
// 创建浏览器窗口
|
||||
win = new BrowserWindow({
|
||||
width: 1024,
|
||||
height: 768,
|
||||
})
|
||||
|
||||
const URL = is_dev
|
||||
? `http://localhost:${process.env.PORT}` // vite 启动的服务器地址
|
||||
: `file://${join(__dirname, '../render/dist/index.html')}` // vite 构建后的静态文件地址
|
||||
|
||||
win.loadURL(URL)
|
||||
}
|
||||
|
||||
app.whenReady().then(createWin)
|
||||
26
src/render/App.vue
Normal file
26
src/render/App.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<div class="logo-box">
|
||||
<img style="height:200px;" src="./assets/electron.png" alt="Electron logo">
|
||||
<img alt="Vue logo" src="./assets/logo.png" />
|
||||
</div>
|
||||
<HelloWorld msg="Hello Electron 9.0 + Vue 3.0 + Vite" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HelloWorld from './components/HelloWorld.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
HelloWorld
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.logo-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
BIN
src/render/assets/electron.png
Normal file
BIN
src/render/assets/electron.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
13
src/render/index.html
Normal file
13
src/render/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
src/render/public/favicon.ico
Normal file
BIN
src/render/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Reference in New Issue
Block a user