feat: 初始化 Wails + React + Go 桌面应用模板
- Wails v2.16.0 + React 19 + TypeScript + Vite 7 - 插件系统(build tag 控制编译,plugin.json 运行时配置) - 支付插件(授权、账号、订单、退款、账单) - 高并发基础设施(任务池、批量处理器、限流器、环形缓冲、管道) - Windows 系统托盘(Win32 API) - CodeGraph 索引 + .memory 记忆包 - 默认图标 assets/icon.png
This commit is contained in:
50
main.go
Normal file
50
main.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"embed"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
|
||||
"go_win_template/internal/plugins"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
//go:embed assets/icon.png
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
wailsApp := NewApp()
|
||||
|
||||
cfg := &options.App{
|
||||
Title: "go_win_template",
|
||||
Width: 1280,
|
||||
Height: 800,
|
||||
MinWidth: 1024,
|
||||
MinHeight: 600,
|
||||
WindowStartState: options.Normal,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
OnStartup: func(ctx context.Context) {
|
||||
log.Println("[main] startup complete")
|
||||
// 启动插件
|
||||
if err := plugins.Start(ctx); err != nil {
|
||||
log.Printf("[main] plugin start error: %v", err)
|
||||
}
|
||||
plugins.PrintStatus()
|
||||
},
|
||||
Bind: []interface{}{
|
||||
wailsApp,
|
||||
},
|
||||
}
|
||||
|
||||
err := wails.Run(cfg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user