mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 16:20:53 +08:00
Merge pull request #1011 from misitebao/optimize-documentation
docs: synchronize and optimize documents
This commit is contained in:
commit
f3b2f6ab76
@ -7,17 +7,18 @@ sidebar_position: 2
|
||||
This page serves as a list for community related links. Please submit a PR (click `Edit this page` at the bottom)
|
||||
to submit links.
|
||||
|
||||
# Awesome Wails
|
||||
## Awesome Wails
|
||||
|
||||
The [definitive list](https://github.com/wailsapp/wails) of links related to Wails.
|
||||
The [definitive list](https://github.com/wailsapp/awesome-wails) of links related to Wails.
|
||||
|
||||
## Support Channels
|
||||
|
||||
- [Gophers Slack Channel](https://gophers.slack.com/messages/CJ4P9F7MZ/)
|
||||
- [Gophers Slack Channel Invite](https://invite.slack.golangbridge.org/)
|
||||
- [Github Issues](https://github.com/wailsapp/wails/issues)
|
||||
- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions/828)
|
||||
- [Gophers Slack Channel](https://gophers.slack.com/messages/CJ4P9F7MZ/)
|
||||
- [Gophers Slack Channel Invite](https://invite.slack.golangbridge.org/)
|
||||
- [Github Issues](https://github.com/wailsapp/wails/issues)
|
||||
- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions/828)
|
||||
|
||||
## Social Media
|
||||
|
||||
- [Twitter](https://twitter.com/wailsapp)
|
||||
- [Twitter](https://twitter.com/wailsapp)
|
||||
- [Wails Chinese Community QQ Group](https://qm.qq.com/cgi-bin/qm/qr?k=PmIURne5hFGNd7QWzW5qd6FV-INEjNJv&jump_from=webapi) - Group number: 1067173054
|
||||
|
@ -36,6 +36,7 @@ func main() {
|
||||
OnStartup: app.startup,
|
||||
OnDomReady: app.domready,
|
||||
OnShutdown: app.shutdown,
|
||||
OnBeforeClose: app.beforeClose,
|
||||
WindowStartState: options.Maximised,
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
@ -315,6 +316,14 @@ Type: \*windows.Options
|
||||
|
||||
This defines [Windows specific options](#windows-specific-options).
|
||||
|
||||
### Mac
|
||||
|
||||
Name: Mac
|
||||
|
||||
Type: \*mac.Options
|
||||
|
||||
This defines [Mac specific options](#mac-specific-options).
|
||||
|
||||
## Windows Specific Options
|
||||
|
||||
### WebviewIsTransparent
|
||||
|
@ -6,6 +6,10 @@ sidebar_position: 2
|
||||
|
||||
此页面用于列出社区相关的链接。请提交 PR(点击页面底部的`编辑此页`)增加链接。
|
||||
|
||||
## 了不起的 Wails
|
||||
|
||||
Wails 相关的[优秀列表](https://github.com/wailsapp/awesome-wails)。
|
||||
|
||||
## 支持的通道
|
||||
|
||||
- [Gophers Slack Channel](https://gophers.slack.com/messages/CJ4P9F7MZ/)
|
||||
|
@ -0,0 +1,10 @@
|
||||
|
||||
# Ytd
|
||||
|
||||
<p>
|
||||
<img src="/img/showcase/ytd.png"></img><br/>
|
||||
</p>
|
||||
|
||||
|
||||
[Ytd](https://github.com/marcio199226/ytd/tree/v2-wails) is an app for downloading tracks from youtube, creating offline playlists and share them with your friends, your friends will be able to playback your playlists or download them for offline listening, has an built-in player.
|
||||
|
@ -0,0 +1,27 @@
|
||||
# 前沿风险技术
|
||||
|
||||
## 概述
|
||||
|
||||
Wails 一直在开发中,新版本会定期“标记”。这通常发生在`master`分支上所有较新的代码都经过测试并确认有效时。如果您需要尚未发布的错误修复或功能,可以通过以下步骤使用最新的“前沿风险”版本:
|
||||
|
||||
- `git clone https://github.com/wailsapp/wails`
|
||||
- `cd wails/v2/cmd/wails`
|
||||
- `go install`
|
||||
|
||||
注意:您将项目克隆到的目录现在将被称为“clonedir”。
|
||||
|
||||
Wails CLI 现在将是最新版本。要更新项目以使用最新版本,请更新项目并确保以下行位于`go.mod`文件底部:
|
||||
|
||||
`replace github.com/wailsapp/wails/v2 => <clonedir>`
|
||||
|
||||
示例:
|
||||
|
||||
在 Windows 上:
|
||||
`replace github.com/wailsapp/wails/v2 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2`
|
||||
|
||||
在'nix 上:
|
||||
`replace github.com/wailsapp/wails/v2 => /home/me/projects/wails/v2`
|
||||
|
||||
要恢复到稳定版本,请运行:
|
||||
|
||||
`go install github.com/wailsapp/wails/v2/cmd/wails@latest`
|
@ -0,0 +1,26 @@
|
||||
# 路由
|
||||
|
||||
路由是一种在应用程序中切换视图的流行方式。此页面提供了有关如何执行此操作的一些指导。
|
||||
|
||||
## Vue
|
||||
|
||||
在 Vue 中推荐的路由方法是[Hash 模式](https://next.router.vuejs.org/guide/essentials/history-mode.html#hash-mode):
|
||||
|
||||
```js
|
||||
import { createRouter, createWebHashHistory } from "vue-router";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes: [
|
||||
//...
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
## Angular
|
||||
|
||||
在 Angular 中推荐的路由方法是[HashLocationStrategy](https://codecraft.tv/courses/angular/routing/routing-strategies/#_hashlocationstrategy):
|
||||
|
||||
```ts
|
||||
RouterModule.forRoot(routes, { useHash: true });
|
||||
```
|
@ -106,7 +106,7 @@ var assets embed.FS
|
||||
|
||||
在即将加载前端`index.html`之前,对 [应用启动回调](/docs/reference/options#应用启动回调) 中提供的函数进行回调。一个标准的 Go 上下文被传递给这个方法。
|
||||
调用运行时需要此上下文,因此标准模式是保存此时对它的引用。在应用程序关闭之前,以同样的方式调用 [应用退出回调](/docs/reference/options#应用退出回调) 回调,
|
||||
再次使用上下文。当前端完成加载`index.html`中所有资源时,还有一个 [前端 Dom 加载完成回调](/docs/reference/options#前端-dom-加载完成回调) 回调,相当于 Javascript 中的`body onload`事件。
|
||||
再次使用上下文。当前端完成加载`index.html`中所有资源时,还有一个 [前端 Dom 加载完成回调](/docs/reference/options#前端-dom-加载完成回调) 回调,相当于 Javascript 中的`body onload`事件。还可以通过设置[关闭应用程序之前回调](/docs/reference/options#关闭应用程序之前回调)选项来控制窗口关闭(或应用程序退出)事件。
|
||||
|
||||
#### 方法绑定
|
||||
|
||||
|
@ -34,7 +34,8 @@ func main() {
|
||||
LogLevel: logger.DEBUG,
|
||||
OnStartup: app.startup,
|
||||
OnDomReady: app.domready,
|
||||
OnShutdown: app.shutdown,,
|
||||
OnShutdown: app.shutdown,
|
||||
OnBeforeClose: app.beforeClose,
|
||||
WindowStartState: options.Maximised,
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
@ -245,6 +246,30 @@ func main() {
|
||||
|
||||
在前端被销毁之后,就在应用程序终止之前,调用此回调。它给出了应用程序上下文。
|
||||
|
||||
### 关闭应用程序之前回调
|
||||
|
||||
名称:OnBeforeClose
|
||||
|
||||
类型:func(ctx context.Context) bool
|
||||
|
||||
如果设置了此回调,它将在通过单击窗口关闭按钮或调用`runtime.Quit`即将退出应用程序时被调用. 返回 `true` 将导致应用程序继续,`false` 将继续正常关闭。这有助于与用户确认他们希望退出程序。
|
||||
|
||||
示例:
|
||||
|
||||
```go title=windowsapp.go
|
||||
func (b *App) beforeClose(ctx context.Context) (prevent bool) {
|
||||
dialog, err := runtime.MessageDialog(ctx, runtime.MessageDialogOptions{
|
||||
Type: runtime.QuestionDialog,
|
||||
Title: "Quit?",
|
||||
Message: "Are you sure you want to quit?",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return dialog != "Yes"
|
||||
```
|
||||
|
||||
### 窗口启动状态
|
||||
|
||||
名称:WindowStartState
|
||||
@ -273,7 +298,15 @@ func main() {
|
||||
|
||||
类型:\*windows.Options
|
||||
|
||||
这定义了[Windows 特定的选项](#windows-特定选项).。
|
||||
这定义了[Windows 特定的选项](#windows-特定选项)。
|
||||
|
||||
### Mac
|
||||
|
||||
名称:Mac
|
||||
|
||||
类型:\*mac.Options
|
||||
|
||||
这定义了[Mac 特定的选项](#mac-特定选项)。
|
||||
|
||||
## Windows 特定选项
|
||||
|
||||
@ -301,6 +334,14 @@ func main() {
|
||||
|
||||
将此设置为 `true` 将删除标题栏左上角的图标。
|
||||
|
||||
### 启用无边框模式的外边框
|
||||
|
||||
名称:EnableFramelessBorder
|
||||
|
||||
类型:bool
|
||||
|
||||
如果已激活[无边框](#无边框),则将此设置为`true`将在窗口周围添加边框。这允许隐藏标题栏但仍然在窗口周围有边框。
|
||||
|
||||
## Mac 特定选项
|
||||
|
||||
### 标题栏
|
||||
|
Loading…
Reference in New Issue
Block a user