Skip to content

Commit 027ceea

Browse files
authored
docs: update docs/wails.md (#988)
1 parent 5f1201e commit 027ceea

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/wails.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Wails V2 备忘清单
33

44
[![GitHub Repo stars](https://img.shields.io/github/stars/wailsapp/wails?style=flat)](https://github.com/wailsapp/wails) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/wailsapp/wails?style=flat)](https://github.com/wailsapp/wails/releases/latest) [![Go Reference](https://pkg.go.dev/badge/github.com/wailsapp/wails/v2.svg)](https://pkg.go.dev/github.com/wailsapp/wails/v2)
55

6-
Wails 是一个基于 Go 和现代 Web 技术(如 Vue、React)构建跨平台桌面应用的轻量级开源框架,可作为 Electron 的替代方案,以下是 Wails v2 的常用命令和示例速查(v3 仍在开发中)。
6+
Wails 是一个基于 Go 和现代 Web 技术(如 Vue、React、Svelte 等)构建跨平台桌面应用的轻量级开源框架,可作为 Electron 的替代方案,以下是 Wails v2 的常用命令和示例速查(v3 仍在开发中)。
77

88
<!--rehype:style=padding-top: 12px;-->
99

@@ -28,19 +28,23 @@ $ wails update -pre
2828
| 命令 | 参数 | 描述 |
2929
| ------- | ----------------------- | ---------------------------------------------------------- |
3030
| `init` | `-n` | **项目名称 (必填)** |
31-
| | `-t` | 模板名称 (`vue`, `react`) 或模板 URL |
31+
| | `-t` | 模板名称 (`vue`, `react`, `svelte`, `angular`) 或模板 URL |
3232
| | `-ide` |`vscode``goland` 生成 IDE 配置 |
33+
| | `-f` | 强制覆盖现有目录 |
3334
| `dev` | `-browser` | 在浏览器中打开前端界面进行调试 |
3435
| | `-assetdir` | 指定前端资产目录的路径 |
3536
| | `-frontenddevserverurl` | 使用外部前端开发服务器的 URL |
3637
| | `-wailsjsdir` | 指定生成的 Wails JS 模块目录 |
38+
| | `-reload` | 启用自动重载 |
3739
| `build` | `-platform` | 交叉编译目标平台, 如 `darwin/arm64` |
3840
| | `-clean` | 构建前清理 `build/bin` 目录 |
3941
| | `-upx` | 使用 UPX 压缩最终的二进制文件 |
4042
| | `-nsis` | (Windows) 生成 NSIS 安装程序 |
4143
| | `-webview2` | (Windows) WebView2 依赖处理策略 (`download`, `embed`, `browser`) |
4244
| | `-debug` | 保留调试信息 |
4345
| | `-devtools` | 在生产版本中启用开发者工具 |
46+
| | `-ldflags` | 传递给 Go 链接器的标志 |
47+
| | `-tags` | 构建标签 |
4448
<!--rehype:className=wrap-text left-align-->
4549

4650
### 项目命令
@@ -49,14 +53,21 @@ $ wails update -pre
4953
# 初始化新项目 (以 Vue 模板为例)
5054
$ wails init -n my-project -t vue
5155

56+
# 使用自定义模板
57+
$ wails init -n my-project -t https://github.com/user/template
58+
5259
# 进入项目目录并启动实时开发
5360
$ cd my-project
5461
$ wails dev
5562

5663
# 构建生产版本 (以 Windows 平台为例)
5764
$ wails build -platform windows/amd64 -clean -upx
65+
5866
# 检查环境依赖
5967
$ wails doctor
68+
69+
# 生成绑定文件
70+
$ wails generate module
6071
```
6172
<!--rehype:className=wrap-text-->
6273

@@ -85,8 +96,12 @@ my-project/
8596
| `frontend:install` | 前端依赖安装命令 | `"npm install"` |
8697
| `frontend:build` | 前端构建命令 | `"npm run build"` |
8798
| `frontend:dev:watcher` | 开发模式下运行的前端监视命令 | `"npm run dev"` |
99+
| `frontend:dev:serverUrl` | 前端开发服务器 URL | `"http://localhost:3000"` |
88100
| `wailsjsdir` | 生成 JS 模块的目录 | `"./frontend/wailsjs"` |
101+
| `assetdir` | 前端资产目录 | `"./frontend/dist"` |
102+
| `reloaddirs` | 监听重载的目录 | `"frontend/src,app.go"` |
89103
| `author.name` | 作者名称,用于打包元数据 | `"Your Name"` |
104+
| `author.email` | 作者邮箱 | `"[email protected]"` |
90105
| `info` | (macOS) 用于 `Info.plist` 的元数据 | `{"CFBundleName": "MyApp"}` |
91106
<!--rehype:className=wrap-text left-align-->
92107

0 commit comments

Comments
 (0)