feat: add mac option

This commit is contained in:
misitebao 2021-11-13 03:03:03 +08:00
parent 20559e0da1
commit 90977fcfdb

View File

@ -7,12 +7,16 @@ import (
"github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger" "github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options" "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/options/windows"
) )
//go:embed frontend/dist //go:embed frontend/dist
var assets embed.FS var assets embed.FS
//go:embed build/appicon.png
var icon []byte
func main() { func main() {
// Create an instance of the app structure // Create an instance of the app structure
// 创建一个App结构体实例 // 创建一个App结构体实例
@ -33,29 +37,36 @@ func main() {
Frameless: true, Frameless: true,
StartHidden: false, StartHidden: false,
HideWindowOnClose: false, HideWindowOnClose: false,
RGBA: &options.RGBA{255,255,255,0}, RGBA: &options.RGBA{255, 255, 255, 0},
Assets: assets, Assets: assets,
LogLevel: logger.DEBUG, LogLevel: logger.DEBUG,
OnStartup: app.startup, OnStartup: app.startup,
OnDomReady: app.domReady, OnDomReady: app.domReady,
OnShutdown: app.shutdown, OnShutdown: app.shutdown,
Bind: []interface{}{ Bind: []interface{}{
app, app,
}, },
// Windows platform specific options // Windows platform specific options
// Windows平台特定选项 // Windows平台特定选项
Windows: &windows.Options{ Windows: &windows.Options{
WebviewIsTransparent: true, WebviewIsTransparent: true,
WindowIsTranslucent: true, WindowIsTranslucent: true,
DisableWindowIcon: false, DisableWindowIcon: false,
},
// Mac platform specific options
// Mac平台特定选项
Mac: &mac.Options{
TitleBar: mac.TitleBarHiddenInset(),
WebviewIsTransparent: true,
WindowIsTranslucent: true,
About: &mac.AboutInfo{
Title: "Wails Template Vue",
Message: "A Wails template based on Vue and Vue-Router",
Icon: icon,
},
}, },
// Mac: &mac.Options{
// WebviewIsTransparent: true,
// WindowBackgroundIsTranslucent: true,
// TitleBar: mac.TitleBarHiddenInset(),
// },
}) })
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }