diff --git a/website/docs/reference/menus.mdx b/website/docs/reference/menus.mdx index ca1f3f404..52f399f0b 100644 --- a/website/docs/reference/menus.mdx +++ b/website/docs/reference/menus.mdx @@ -10,7 +10,21 @@ setting it in the [`Menu`](../reference/options.mdx#menu) application config, or An example of how to create a menu, using [the `NewApp` scaffold](../guides/application-development.mdx): -```go +```go title="main.go" +package main + +import ( + "log" + "runtime" + + "github.com/wailsapp/wails/v2" + "github.com/wailsapp/wails/v2/pkg/menu" + "github.com/wailsapp/wails/v2/pkg/menu/keys" + "github.com/wailsapp/wails/v2/pkg/options" + rt "github.com/wailsapp/wails/v2/pkg/runtime" +) + +func main() { app := NewApp() AppMenu := menu.NewMenu() @@ -40,7 +54,10 @@ An example of how to create a menu, using [the `NewApp` scaffold](../guides/appl app, }, }) - // ... + if err != nil { + log.Fatal(err) + } +} ``` It is also possible to dynamically update the menu, by updating the menu struct and calling diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 00d9ac455..271f24a87 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Updated menu reference docs with complete imports by @agilgur5 in [#4727](https://github.com/wailsapp/wails/pull/4727) +- Updated menu reference docs with complete imports by @agilgur5 in [#4727](https://github.com/wailsapp/wails/pull/4727) and [#4742](https://github.com/wailsapp/wails/pull/4742) - Fixed menu reference syntax by @agilgur5 in [#4726](https://github.com/wailsapp/wails/pull/4726) - Fixed indentation in Application Development guide by @agilgur5 in [#4730](https://github.com/wailsapp/wails/pull/4730) - Updated Application Development guide to show imports in the `app.go` snippets by @agilgur5 in [#4731](https://github.com/wailsapp/wails/pull/4731)