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
相關文章
相關標籤/搜索