From 29e598409127ebc50983bb00ab9d1acaa0e0c49c Mon Sep 17 00:00:00 2001 From: misitebao Date: Mon, 14 Feb 2022 21:11:36 +0800 Subject: [PATCH] feat: update options parameter to cancel borderless mode --- app.tmpl.go | 10 ++++++++++ frontend/JS/src/App.vue | 2 -- frontend/TS/src/App.vue | 2 -- frontend/package.tmpl.json | 3 ++- go.mod.tmpl => go.tmpl.mod | 0 main.tmpl.go | 22 ++++++++++++++++++---- 6 files changed, 30 insertions(+), 9 deletions(-) rename go.mod.tmpl => go.tmpl.mod (100%) diff --git a/app.tmpl.go b/app.tmpl.go index daa42b4..03881c3 100644 --- a/app.tmpl.go +++ b/app.tmpl.go @@ -30,6 +30,16 @@ func (a *App) domReady(ctx context.Context) { // 在这里添加你的操作 } +// beforeClose is called when the application is about to quit, +// either by clicking the window close button or calling runtime.Quit. +// Returning true will cause the application to continue, +// false will continue shutdown as normal. +// beforeClose在单击窗口关闭按钮或调用runtime.Quit即将退出应用程序时被调用. +// 返回 true 将导致应用程序继续,false 将继续正常关闭。 +func (a *App) beforeClose(ctx context.Context) (prevent bool) { + return false +} + // shutdown is called at application termination // 在应用程序终止时被调用 func (a *App) shutdown(ctx context.Context) { diff --git a/frontend/JS/src/App.vue b/frontend/JS/src/App.vue index 11b1fae..4140484 100644 --- a/frontend/JS/src/App.vue +++ b/frontend/JS/src/App.vue @@ -102,8 +102,6 @@ body { // width: 900px; // height: 520px; height: 100%; - margin-right: 1px; - border-radius: 6px; background-color: rgba(219,188,239,.9); overflow: hidden; } diff --git a/frontend/TS/src/App.vue b/frontend/TS/src/App.vue index 87149fa..d3338db 100644 --- a/frontend/TS/src/App.vue +++ b/frontend/TS/src/App.vue @@ -102,8 +102,6 @@ body { // width: 900px; // height: 520px; height: 100%; - margin-right: 1px; - border-radius: 6px; background-color: rgba(219,188,239,.9); overflow: hidden; } diff --git a/frontend/package.tmpl.json b/frontend/package.tmpl.json index 638d106..01cce5a 100644 --- a/frontend/package.tmpl.json +++ b/frontend/package.tmpl.json @@ -11,6 +11,7 @@ "license": "ISC", "workspaces": ["JS", "TS"], "engines": { - "npm": ">=7.0.0" + "npm": ">=7.0.0", + "node": ">=15.0.0" } } diff --git a/go.mod.tmpl b/go.tmpl.mod similarity index 100% rename from go.mod.tmpl rename to go.tmpl.mod diff --git a/main.tmpl.go b/main.tmpl.go index c9898e8..80e54b1 100644 --- a/main.tmpl.go +++ b/main.tmpl.go @@ -34,15 +34,19 @@ func main() { MaxHeight: 1200, DisableResize: false, Fullscreen: false, - Frameless: true, + Frameless: false, StartHidden: false, HideWindowOnClose: false, - RGBA: &options.RGBA{255, 255, 255, 0}, + RGBA: &options.RGBA{R: 255, G: 255, B: 255, A: 0}, Assets: assets, + Menu: nil, + Logger: nil, LogLevel: logger.DEBUG, OnStartup: app.startup, OnDomReady: app.domReady, + OnBeforeClose: app.beforeClose, OnShutdown: app.shutdown, + WindowStartState: options.Normal, Bind: []interface{}{ app, }, @@ -50,13 +54,23 @@ func main() { // Windows平台特定选项 Windows: &windows.Options{ WebviewIsTransparent: true, - WindowIsTranslucent: true, + WindowIsTranslucent: false, DisableWindowIcon: false, + // DisableFramelessWindowDecorations: false, + WebviewUserDataPath: "", }, // Mac platform specific options // Mac平台特定选项 Mac: &mac.Options{ - TitleBar: mac.TitleBarHiddenInset(), + TitleBar: &mac.TitleBar{ + TitlebarAppearsTransparent: true, + HideTitle: false, + HideTitleBar: false, + FullSizeContent: false, + UseToolbar: false, + HideToolbarSeparator: true, + }, + Appearance: mac.NSAppearanceNameDarkAqua, WebviewIsTransparent: true, WindowIsTranslucent: true, About: &mac.AboutInfo{