使用了Go的wails库
Wails 是一个可让您使用 Go 和 Web 技术编写桌面应用的项目。
将它看作为 Go 的快并且轻量的 Electron 替代品。 您可以使用 Go 的灵活性和强大功能,结合丰富的现代前端,轻松的构建应用程序
https://wails.io/zh-Hans/docs/introduction
这里默认了你已经安装了Go和Node
首先安装wails
go install github.com/wailsapp/wails/v2/cmd/wails@latest
创建项目
我这里用的是react模板, 可选的有svelte, vue
wails init -n 项目名 -t react
安装antd, react-router
在walis中, 前端的所有逻辑都放在frontend目录下, 所以我们需要进入到项目的frontend目录下去安装我们需要的前端库
cd 你的项目名 cd .\frontend\ npm install antd npm i @ant-design/pro-components npm i react-router-dom
默认项目创建出来是3.x的vite, 我为了尝新, 主动修改了package.json中的版本
"devDependencies": { "@types/react": "^18.0.17", "@types/react-dom": "^18.0.6", "@vitejs/plugin-react": "^4.0.0", "vite": "^4.3.3" }
启动项目
wails dev
发表回复