Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mini-berry committed Jul 18, 2024
1 parent 88c5809 commit db6ab48
Show file tree
Hide file tree
Showing 41 changed files with 5,886 additions and 643 deletions.
28 changes: 12 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.idea
.vscode
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

#Electron-builder output
/dist_electron


package-lock.json
#release
/release/
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}
13 changes: 0 additions & 13 deletions LICENSE

This file was deleted.

35 changes: 3 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
# rospanel
本项目当前的业务需求为显示超声波模块测到的6个距离。
# Vue 3 + TypeScript + Vite

## 环境配置
node = v16.20.2
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

npm = 8.19.4

再装个cnpm
## 使用说明
1. 依赖安装
```
cnpm install
```
注:electron换国内镜像源也不好下,这里最好用cnpm

2. dev模式
```
cnpm run serve
```

3. production,打包桌面应用程序
```
cnpm run build
cnpm run electron:build
```
最终打包后的程序在dist目录下的.AppImage文件





## Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
5 changes: 0 additions & 5 deletions babel.config.js

This file was deleted.

17 changes: 17 additions & 0 deletions dist-electron/assets/index-CkTf4G4D.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist-electron/assets/index-CusWAS5C.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions dist-electron/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="./vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RosPanel</title>
<script type="module" crossorigin src="./assets/index-CkTf4G4D.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-CusWAS5C.css">
</head>
<body>
<div id="app"></div>
</body>
</html>
1 change: 1 addition & 0 deletions dist-electron/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist-electron/preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"use strict";const o=require("os");console.log("platform",o.platform());
1 change: 1 addition & 0 deletions dist-electron/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions electron-main/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// electron-main/index.ts
import { app, BrowserWindow } from "electron"
import path from "path"

const createWindow = () => {
const win = new BrowserWindow({
webPreferences: {
contextIsolation: false, // 是否开启隔离上下文
nodeIntegration: true, // 渲染进程使用Node API
preload: path.join(__dirname, "./preload.js"), // 需要引用js文件
},
})

// 如果打包了,渲染index.html
if (process.env.NODE_ENV !== 'development') {
win.loadFile(path.join(__dirname, "./index.html"))
win.webContents.openDevTools()
} else {
let url = "http://localhost:5173" // 本地启动的vue项目路径。注意:vite版本3以上使用的端口5173;版本2用的是3000
win.loadURL(url)
win.webContents.openDevTools()
}
}

app.whenReady().then(() => {
createWindow() // 创建窗口
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})

// 关闭窗口
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit()
}
})
3 changes: 3 additions & 0 deletions electron-preload/preload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// electron-preload/preload.ts
import os from "os";
console.log("platform", os.platform());
3 changes: 3 additions & 0 deletions extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RosPanel</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
19 changes: 0 additions & 19 deletions jsconfig.json

This file was deleted.

Loading

0 comments on commit db6ab48

Please sign in to comment.