关于go模板的问题
感觉golang模板方面的资料比较少
我想问,例如,平常引入一个子模板是用
{{template “subtemp.tpl” .}}这样的例子
但是,我想让中间的”subtemp.tpl”是传过来的变量
但是,现在就不知道怎么写才能加载这个子模板了。
感觉golang模板方面的资料比较少
我想问,例如,平常引入一个子模板是用
{{template “subtemp.tpl” .}}这样的例子
但是,我想让中间的”subtemp.tpl”是传过来的变量
但是,现在就不知道怎么写才能加载这个子模板了。
共 3 个回复
jiaox
test.tpl:
template: {{.Template}}
output:
template: “template”
jimmykuu
template
方法动态加载模板实现不了。snake117
@jimmykuu 最新的特性
block
行不行?