File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,12 @@ import (
99 "github.com/wailsapp/wails/v2/pkg/options"
1010 "github.com/wailsapp/wails/v2/pkg/options/mac"
1111 "github.com/wailsapp/wails/v2/pkg/options/windows"
12+ "github.com/wailsapp/wails/v2/pkg/runtime"
1213 "go-stock/backend/data"
1314 "go-stock/backend/db"
1415 "log"
1516 "os"
17+ "time"
1618)
1719
1820//go:embed frontend/dist
@@ -41,6 +43,15 @@ func main() {
4143 // Create an instance of the app structure
4244 app := NewApp ()
4345
46+ ticker := time .NewTicker (time .Second )
47+ defer ticker .Stop ()
48+ //定时更新数据
49+ go func () {
50+ for range ticker .C {
51+ runtime .WindowSetTitle (app .ctx , "go-stock " + time .Now ().Format ("2006-01-02 15:04:05" ))
52+ }
53+ }()
54+
4455 // Create application with options
4556 err := wails .Run (& options.App {
4657 Title : "go-stock" ,
@@ -100,6 +111,7 @@ func main() {
100111 if err != nil {
101112 log .Fatal (err )
102113 }
114+
103115}
104116
105117func initStockData () {
You can’t perform that action at this time.
0 commit comments