diff --git a/main.go b/main.go index d23eb2b..85e6c6a 100644 --- a/main.go +++ b/main.go @@ -9,10 +9,12 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options/mac" "github.com/wailsapp/wails/v2/pkg/options/windows" + "github.com/wailsapp/wails/v2/pkg/runtime" "go-stock/backend/data" "go-stock/backend/db" "log" "os" + "time" ) //go:embed frontend/dist @@ -41,6 +43,15 @@ func main() { // Create an instance of the app structure app := NewApp() + ticker := time.NewTicker(time.Second) + defer ticker.Stop() + //定时更新数据 + go func() { + for range ticker.C { + runtime.WindowSetTitle(app.ctx, "go-stock "+time.Now().Format("2006-01-02 15:04:05")) + } + }() + // Create application with options err := wails.Run(&options.App{ Title: "go-stock", @@ -100,6 +111,7 @@ func main() { if err != nil { log.Fatal(err) } + } func initStockData() {