beego 页面布局

模板html

this.Layout = "admin/layout.html"
this.TplName = "admin/list.html"

在layout.html中必须有一下代码,才能显示list.htmlthis

{{.Layout.Content}}

LayoutSectioncode

this.Layout = "layout.html"
this.LayoutSections = make(map[string]string)
this.LayoutSections["contentHead"] = "head.html"
this.TplName = "content.html"
LayoutSections在layout.html插入{{.contentHead}} 代替head.html
相关文章
相关标签/搜索