在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:maxence-charriere/go-app开源软件地址:https://github.com/maxence-charriere/go-app开源编程语言:Go 97.0%开源软件介绍:Go-app is a package for building progressive web apps (PWA) with the Go programming language (Golang) and WebAssembly (Wasm). Shaping a UI is done by using a declarative syntax that creates and compose HTML elements only by using the Go programing language. It uses Go HTTP standard model. An app created with go-app can out of the box run in its own window, supports offline mode, and are SEO friendly. Documentation (built with go-app)Installgo-app requirements: go mod init
go get -u github.com/maxence-charriere/go-app/v9/pkg/app Declarative syntaxGo-app uses a declarative syntax so you can write reusable component-based UI elements just by using the Go programming language. Here is a Hello World component that takes an input and displays its value in its title: type hello struct {
app.Compo
name string
}
func (h *hello) Render() app.UI {
return app.Div().Body(
app.H1().Body(
app.Text("Hello, "),
app.If(h.name != "",
app.Text(h.name),
).Else(
app.Text("World!"),
),
),
app.P().Body(
app.Input().
Type("text").
Value(h.name).
Placeholder("What is your name?").
AutoFocus(true).
OnChange(h.ValueTo(&h.name)),
),
)
} Standard HTTPApps created with go-app complies with Go standard HTTP package interfaces. func main() {
// Components routing:
app.Route("/", &hello{})
app.Route("/hello", &hello{})
app.RunWhenOnBrowser()
// HTTP routing:
http.Handle("/", &app.Handler{
Name: "Hello",
Description: "An Hello World! example",
})
if err := http.ListenAndServe(":8000", nil); err != nil {
log.Fatal(err)
}
} Getting startedRead the Getting Started document. Built with go-appContributorsCode ContributorsThis project exists thanks to all the people who contribute. [Contribute]. Financial ContributorsBecome a financial contributor and help us sustain go-app development. [Contribute] IndividualsOrganizationsSupport this project with your organization. Your logo will show up here with a link to your website. [Contribute] |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论