package handler import ( "context" "file-manage-ui/data" "github.com/wailsapp/wails/v3/pkg/application" ) type Ctx struct { ctx context.Context } // Service struct type Service struct { //ctx context.Context Ctx *Ctx } // NewService creates a new App application struct func NewService(Ctx *Ctx) *Service { return &Service{Ctx: Ctx} } // Startup is called when the app starts. The context is saved, // so we can call the runtime methods func (a *Ctx) Startup(ctx context.Context) { a.ctx = ctx } // CloseApp 根据名称关闭窗口 func (a *Service) CloseApp(winName string) { if winName == "login-page" { } } func (a *Service) OpenLoginPage() { LoginWindow(data.App) } func LoginWindow(app *application.App) { //窗口管理 win1 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{ Title: "Login", Name: "login", Mac: application.MacWindow{ InvisibleTitleBarHeight: 50, Backdrop: application.MacBackdropTranslucent, TitleBar: application.MacTitleBarHiddenInset, }, Frameless: true, Windows: application.WindowsWindow{}, //BackgroundColour: application.NewRGB(27, 38, 54), URL: "/#/login", EnableDragAndDrop: true, }) // 加载窗口到 管理器中 data.WindowMap[win1] = true }