12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package main
- import (
- "embed"
- _ "embed"
- "log"
- "github.com/wailsapp/wails/v3/pkg/application"
- )
- // Wails uses Go's `embed` package to embed the frontend files into the binary.
- // Any files in the frontend/dist folder will be embedded into the binary and
- // made available to the frontend.
- // See https://pkg.go.dev/embed for more information.
- //go:embed all:frontend/dist
- var assets embed.FS
- // main function serves as the application's entry point. It initializes the application, creates a window,
- // and starts a goroutine that emits a time-based event every second. It subsequently runs the application and
- // logs any error that might occur.
- func main() {
- // Create a new Wails application by providing the necessary options.
- // Variables 'Name' and 'Description' are for application metadata.
- // 'Assets' configures the asset server with the 'FS' variable pointing to the frontend files.
- // 'Bind' is a list of Go struct instances. The frontend has access to the methods of these instances.
- // 'Mac' options tailor the application when running an macOS.
- app := application.New(application.Options{
- Name: "剑鱼招聘管理助手/简历批量上传",
- Description: "剑鱼招聘管理助手简历批量上传",
- Services: []application.Service{
- //application.NewService(&GreetService{}),
- },
- Assets: application.AssetOptions{
- Handler: application.AssetFileServerFS(assets),
- },
- Mac: application.MacOptions{
- ApplicationShouldTerminateAfterLastWindowClosed: true,
- },
- })
- // Create a new window with the necessary options.
- // 'Title' is the title of the window.
- // 'Mac' options tailor the window when running on macOS.
- // 'BackgroundColour' is the background colour of the window.
- // 'URL' is the URL that will be loaded into the webview.
- app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
- Title: "剑鱼招聘管理助手/简历批量上传",
- Mac: application.MacWindow{
- InvisibleTitleBarHeight: 50,
- Backdrop: application.MacBackdropTranslucent,
- TitleBar: application.MacTitleBarHiddenInset,
- },
- // DragAndDrop: &options.DragAndDrop{
- // EnableFileDrop: false,
- // DisableWebViewDrop: false,
- // CSSDropProperty: "--wails-drop-target",
- // CSSDropValue: "drop",
- // },
- BackgroundColour: application.NewRGB(255, 255, 255),
- //DisableResize: true,
- Width: 668,
- FullscreenButtonEnabled: false,
- ZoomControlEnabled: false,
- EnableDragAndDrop: true,
- MinimiseButtonState: application.ButtonDisabled,
- MaximiseButtonState: application.ButtonDisabled,
- URL: "/",
- })
- // Run the application. This blocks until the application has been exited.
- err := app.Run()
- // If an error occurred while running the application, log it and exit.
- if err != nil {
- log.Fatal(err)
- }
- }
|