Start with asset registration, a standard page shell, and a small body composed from Paw primitives. This is the baseline pattern the rest of the docs build on.
paw.PathAssetspaw.NewAssetsHttpHandler()paw.RenderHeader()paw.Containerpaw.RenderDefaultFooter()API 接口 |
Description 说明 |
|---|---|
PathAssets + NewAssetsHttpHandler() |
Serve Paw's embedded CSS, JavaScript, icons, and third-party assets. 为 Paw 内置的 CSS、JavaScript、图标和第三方资源提供静态服务。 |
RenderHeader + RenderDefaultFooter() |
Wrap every page with the default document shell and bundled scripts. 用默认文档壳和内置脚本包裹每个页面。 |
Container |
Put your app body inside the default responsive container. 把应用主体放进默认的响应式容器里。 |
Register the asset handler once, then render a normal http handler with a Paw header, container, and footer.
This body is just normal Paw UI rendered inside a standard page shell.
http.HandleFunc(paw.PathAssets, paw.NewAssetsHttpHandler())
func renderPage(w http.ResponseWriter, title string, body paw.Ui) {
paw.RenderHeader(paw.HeaderConfig{
Wr: w,
Title: title,
})
if err := (paw.Container{Body: body}).Render(w); err != nil {
panic(err)
}
paw.RenderDefaultFooter(w)
}
Once the shell is in place, keep adding higher-level layout pieces instead of dropping to raw HTML.
Start with the shell, then compose your body from panels, rows, and forms.
Use the canonical docs pages as a map of the public API.
body := paw.List{
paw.H1("Users"),
paw.Row{
ColumnMax: 2,
Columns: paw.List{
paw.Panel{Title: paw.String("List"), Body: paw.String("...")},
paw.Panel{Title: paw.String("Actions"), Body: paw.String("...")},
},
},
}
renderPage(w, "Users", body)
Paw only renders HTML. Routing, data loading, validation, and persistence still live in your application code.
Use the default header and footer unless you intentionally want to replace Paw's bundled assets and script wiring.