mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-15 00:19:30 +08:00
[v2]feat: optimize the content of the default template
This commit is contained in:
parent
fe6dd4d18f
commit
54a401106b
@ -21,6 +21,11 @@ func (b *App) startup(ctx context.Context) {
|
|||||||
b.ctx = ctx
|
b.ctx = ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// domReady is called after the front-end dom has been loaded
|
||||||
|
func (b App) domReady(ctx context.Context) {
|
||||||
|
// Add your action here
|
||||||
|
}
|
||||||
|
|
||||||
// shutdown is called at application termination
|
// shutdown is called at application termination
|
||||||
func (b *App) shutdown(ctx context.Context) {
|
func (b *App) shutdown(ctx context.Context) {
|
||||||
// Perform your teardown here
|
// Perform your teardown here
|
||||||
|
@ -23,5 +23,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sirv-cli": "^1.0.0"
|
"sirv-cli": "^1.0.0"
|
||||||
}
|
},
|
||||||
,"author":"{{.AuthorName}}"}
|
"author": "{{.AuthorName}}"
|
||||||
|
}
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"embed"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v2"
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/logger"
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:embed frontend/dist
|
|
||||||
var assets embed.FS
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
|
|
||||||
// Create application with options
|
|
||||||
app := NewApp()
|
|
||||||
|
|
||||||
err := wails.Run(&options.App{
|
|
||||||
Title: "",
|
|
||||||
Width: 800,
|
|
||||||
Height: 600,
|
|
||||||
MinWidth: 400,
|
|
||||||
MinHeight: 400,
|
|
||||||
MaxWidth: 1280,
|
|
||||||
MaxHeight: 1024,
|
|
||||||
DisableResize: false,
|
|
||||||
Fullscreen: false,
|
|
||||||
Frameless: false,
|
|
||||||
StartHidden: false,
|
|
||||||
HideWindowOnClose: false,
|
|
||||||
RGBA: 0x000000FF,
|
|
||||||
Assets: assets,
|
|
||||||
Windows: &windows.Options{
|
|
||||||
WebviewIsTransparent: true,
|
|
||||||
WindowIsTranslucent: true,
|
|
||||||
DisableWindowIcon: true,
|
|
||||||
},
|
|
||||||
LogLevel: logger.DEBUG,
|
|
||||||
OnStartup: app.startup,
|
|
||||||
OnShutdown: app.shutdown,
|
|
||||||
Bind: []interface{}{
|
|
||||||
app,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,54 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v2"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/logger"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/options"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed frontend/dist
|
||||||
|
var assets embed.FS
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Create an instance of the app structure
|
||||||
|
app := NewApp()
|
||||||
|
|
||||||
|
// Create application with options
|
||||||
|
err := wails.Run(&options.App{
|
||||||
|
Title: "{{.ProjectName}}",
|
||||||
|
Width: 720,
|
||||||
|
Height: 570,
|
||||||
|
MinWidth: 720,
|
||||||
|
MinHeight: 570,
|
||||||
|
MaxWidth: 1280,
|
||||||
|
MaxHeight: 740,
|
||||||
|
DisableResize: false,
|
||||||
|
Fullscreen: false,
|
||||||
|
Frameless: false,
|
||||||
|
StartHidden: false,
|
||||||
|
HideWindowOnClose: false,
|
||||||
|
RGBA: &options.RGBA{255, 255, 255, 255},
|
||||||
|
Assets: assets,
|
||||||
|
LogLevel: logger.DEBUG,
|
||||||
|
OnStartup: app.startup,
|
||||||
|
OnDomReady: app.domReady,
|
||||||
|
OnShutdown: app.shutdown,
|
||||||
|
Bind: []interface{}{
|
||||||
|
app,
|
||||||
|
},
|
||||||
|
// Windows platform specific options
|
||||||
|
Windows: &windows.Options{
|
||||||
|
WebviewIsTransparent: false,
|
||||||
|
WindowIsTranslucent: false,
|
||||||
|
DisableWindowIcon: false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Basic Svelte + Rollup",
|
"name": "Basic Svelte + Rollup",
|
||||||
"shortname": "svelte",
|
"shortname": "svelte",
|
||||||
"author": "Lea Anthony",
|
"author": "Lea Anthony <lea.anthony@gmail.com>",
|
||||||
"description": "Svelte template using rollup to bundle css, images and fonts",
|
"description": "Svelte template using rollup to bundle css, images and fonts",
|
||||||
"helpurl": "https://github.com/wailsapp/wails"
|
"helpurl": "https://github.com/wailsapp/wails"
|
||||||
}
|
}
|
@ -2,8 +2,8 @@
|
|||||||
"name": "{{.ProjectName}}",
|
"name": "{{.ProjectName}}",
|
||||||
"outputfilename": "{{.BinaryName}}",
|
"outputfilename": "{{.BinaryName}}",
|
||||||
"assetdir": "frontend/dist",
|
"assetdir": "frontend/dist",
|
||||||
"frontend:build": "npm run build",
|
|
||||||
"frontend:install": "npm install",
|
"frontend:install": "npm install",
|
||||||
|
"frontend:build": "npm run build",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "{{.AuthorName}}",
|
"name": "{{.AuthorName}}",
|
||||||
"email": "{{.AuthorEmail}}"
|
"email": "{{.AuthorEmail}}"
|
||||||
|
@ -21,6 +21,11 @@ func (b *App) startup(ctx context.Context) {
|
|||||||
b.ctx = ctx
|
b.ctx = ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// domReady is called after the front-end dom has been loaded
|
||||||
|
func (b App) domReady(ctx context.Context) {
|
||||||
|
// Add your action here
|
||||||
|
}
|
||||||
|
|
||||||
// shutdown is called at application termination
|
// shutdown is called at application termination
|
||||||
func (b *App) shutdown(ctx context.Context) {
|
func (b *App) shutdown(ctx context.Context) {
|
||||||
// Perform your teardown here
|
// Perform your teardown here
|
||||||
|
@ -14,10 +14,10 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// Create an instance of the app structure
|
||||||
// Create application with options
|
|
||||||
app := NewApp()
|
app := NewApp()
|
||||||
|
|
||||||
|
// Create application with options
|
||||||
err := wails.Run(&options.App{
|
err := wails.Run(&options.App{
|
||||||
Title: "{{.ProjectName}}",
|
Title: "{{.ProjectName}}",
|
||||||
Width: 720,
|
Width: 720,
|
||||||
@ -33,17 +33,19 @@ func main() {
|
|||||||
HideWindowOnClose: false,
|
HideWindowOnClose: false,
|
||||||
RGBA: &options.RGBA{255, 255, 255, 255},
|
RGBA: &options.RGBA{255, 255, 255, 255},
|
||||||
Assets: assets,
|
Assets: assets,
|
||||||
|
LogLevel: logger.DEBUG,
|
||||||
|
OnStartup: app.startup,
|
||||||
|
OnDomReady: app.domReady,
|
||||||
|
OnShutdown: app.shutdown,
|
||||||
|
Bind: []interface{}{
|
||||||
|
app,
|
||||||
|
},
|
||||||
|
// Windows platform specific options
|
||||||
Windows: &windows.Options{
|
Windows: &windows.Options{
|
||||||
WebviewIsTransparent: false,
|
WebviewIsTransparent: false,
|
||||||
WindowIsTranslucent: false,
|
WindowIsTranslucent: false,
|
||||||
DisableWindowIcon: false,
|
DisableWindowIcon: false,
|
||||||
},
|
},
|
||||||
LogLevel: logger.DEBUG,
|
|
||||||
OnStartup: app.startup,
|
|
||||||
OnShutdown: app.shutdown,
|
|
||||||
Bind: []interface{}{
|
|
||||||
app,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Vanilla HTML/JS/CSS",
|
"name": "Vanilla HTML/JS/CSS",
|
||||||
"shortname": "vanilla",
|
"shortname": "vanilla",
|
||||||
"author": "Lea Anthony<lea.anthony@gmail.com>",
|
"author": "Lea Anthony <lea.anthony@gmail.com>",
|
||||||
"description": "A simple template using only HTML/CSS/JS",
|
"description": "A simple template using only HTML/CSS/JS",
|
||||||
"helpurl": "https://github.com/wailsapp/wails"
|
"helpurl": "https://github.com/wailsapp/wails"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user