From d240239fcc5da30535269b0cf701717a24fa43d6 Mon Sep 17 00:00:00 2001 From: spark Date: Thu, 19 Dec 2024 20:59:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=A0=87=E9=A2=98=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=BD=93=E5=89=8D=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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() {