wails-template-vue/main.tmpl.go

74 lines
1.7 KiB
Go
Raw Normal View History

2021-09-08 08:58:58 +08:00
package main
import (
"embed"
"log"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
2021-11-13 03:03:03 +08:00
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
2021-09-08 08:58:58 +08:00
)
//go:embed frontend/dist
var assets embed.FS
2021-11-13 03:03:03 +08:00
//go:embed build/appicon.png
var icon []byte
2021-09-08 08:58:58 +08:00
func main() {
// Create an instance of the app structure
// 创建一个App结构体实例
app := NewApp()
2021-09-08 08:58:58 +08:00
// Create application with options
2021-09-09 05:17:10 +08:00
// 使用选项创建应用
2021-09-08 08:58:58 +08:00
err := wails.Run(&options.App{
Title: "{{.ProjectName}}",
Width: 1600,
Height: 1000,
2021-09-09 22:20:54 +08:00
MinWidth: 1600,
MinHeight: 1000,
2021-09-08 08:58:58 +08:00
MaxWidth: 2000,
2021-09-09 22:20:54 +08:00
MaxHeight: 1200,
2021-09-08 08:58:58 +08:00
DisableResize: false,
Fullscreen: false,
Frameless: true,
2021-09-08 08:58:58 +08:00
StartHidden: false,
HideWindowOnClose: false,
2021-11-13 03:03:03 +08:00
RGBA: &options.RGBA{255, 255, 255, 0},
2021-09-08 08:58:58 +08:00
Assets: assets,
2021-11-13 03:03:03 +08:00
LogLevel: logger.DEBUG,
OnStartup: app.startup,
OnDomReady: app.domReady,
OnShutdown: app.shutdown,
Bind: []interface{}{
app,
},
// Windows platform specific options
// Windows平台特定选项
2021-09-08 08:58:58 +08:00
Windows: &windows.Options{
2021-11-13 03:03:03 +08:00
WebviewIsTransparent: true,
WindowIsTranslucent: true,
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,
},
2021-09-08 08:58:58 +08:00
},
})
2021-11-13 03:03:03 +08:00
2021-09-08 08:58:58 +08:00
if err != nil {
log.Fatal(err)
}
}