Update 03-notes-vanilla.mdx (#4917)

* Update 03-notes-vanilla.mdx

The API has been hanged.
application.SaveFileDialog() -> application.Get().Dialog.SaveFile()
application.OpenFileDialog() -> application.Get().Dialog.OpenFile()
application.InfoDialog() -> application.Get().Dialog.Info()

Please refer to the document.
https://v3alpha.wails.io/reference/dialogs/

* Update docs/src/content/docs/tutorials/03-notes-vanilla.mdx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
drc5521 2026-01-29 03:04:45 +08:00 committed by GitHub
commit 679e4843d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -115,7 +115,7 @@ In this tutorial, you'll build a notes application that demonstrates file operat
// SaveToFile saves notes to a file
func (n *NotesService) SaveToFile() error {
path, err := application.SaveFileDialog().
path, err := application.Get().Dialog.SaveFile().
SetFilename("notes.json").
AddFilter("JSON Files", "*.json").
PromptForSingleSelection()
@ -133,7 +133,7 @@ In this tutorial, you'll build a notes application that demonstrates file operat
return err
}
application.InfoDialog().
application.Get().Dialog.Info().
SetTitle("Success").
SetMessage("Notes saved successfully!").
Show()
@ -143,7 +143,7 @@ In this tutorial, you'll build a notes application that demonstrates file operat
// LoadFromFile loads notes from a file
func (n *NotesService) LoadFromFile() error {
path, err := application.OpenFileDialog().
path, err := application.Get().Dialog.OpenFile().
AddFilter("JSON Files", "*.json").
PromptForSingleSelection()
@ -163,7 +163,7 @@ In this tutorial, you'll build a notes application that demonstrates file operat
n.notes = notes
application.InfoDialog().
application.Get().Dialog.Info().
SetTitle("Success").
SetMessage("Notes loaded successfully!").
Show()
@ -180,8 +180,8 @@ In this tutorial, you'll build a notes application that demonstrates file operat
- **Note struct**: Defines the data structure with JSON tags (lowercase) for proper serialization
- **CRUD operations**: GetAll, Create, Update, and Delete for managing notes in memory
- **File dialogs**: Uses package-level functions `application.SaveFileDialog()` and `application.OpenFileDialog()`
- **Info dialogs**: Shows success messages using `application.InfoDialog()`
- **File dialogs**: Uses `application.Get().Dialog.SaveFile()` and `application.Get().Dialog.OpenFile()` to access native dialogs
- **Info dialogs**: Shows success messages using `application.Get().Dialog.Info()`
- **ID generation**: Simple timestamp-based ID generator
3. **Update main.go**