簡體   English   中英

go-gin中{{template“ base”}}和{{template“ base”。}}之間的區別

[英]Difference between {{template “base” }} and {{template “base” .}} in go-gin

{{template "base" }}{{template "base" .}}什么區別?

我使用go-gin,兩者都可以正常運行。 我在文檔中找不到關於此的任何描述。

godoc文本/模板中

{{template "name"}}
指定名稱的模板將使用nil數據執行。

{{template "name" pipeline}}
指定名稱的模板在將點設置為管道值的情況下執行。

因此, {{template "base"}}調用上下文中沒有數據的模板base (當然,全局變量仍然可用),而{{template "base" .}}則使用范圍內的任何數據調用它{{template "base" .}}通話點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM