整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:

红色工作报告PPT模板-免费下载

刀PPT提供免费PPT模板,红色工作报告PPT模板,模板是设计好的PPT模板直接打开编辑即可。

页数:16页

编号:PPT96276

大小:4.39MB

软件:PowerPoint

格式:PPTX

比例:16:9

复制下载:ppt.101dao.com/ppt/ppt-PPT96276.html

据说点“赞”的人很漂亮,点“喜欢”的人很好看,我的饭碗就靠你们了Thanks♪(・ω・)ノ。

们可以使用以下的方式去渲染html

func main() {
	router := gin.Default()
	router.LoadHTMLGlob("templates/*")
	//router.LoadHTMLFiles("templates/template1.html", "templates/template2.html")
	router.GET("/index", func(c *gin.Context) {
		c.HTML(http.StatusOK, "index.tmpl", gin.H{
			"title": "Main website",
		})
	})
	router.Run(":8080")
}

在html中我们可以使用特殊的双花括号来渲染title这个值

<html>
	<h1>
		{{ .title }}
	</h1>
</html>

值得注意的是这种方式并不是gin特有的,而是golang特有的,它还有其他的模板语法。


模板语法:

定义变量:

{{$article := "hello"}}

也可以给变量赋值

{{$article := .ArticleContent}}

函数的调用:

{{funcname .arg1 .arg2}}

判断语法:

{{if .condition}}
{{end}}
{{if .condition1}}
{{else if .contition2}}
{{end}}
  • not 非
{{if not .condition}}
{{end}}
  • and 与
{{if and .condition1 .condition2}}
{{end}}
  • or 或
{{if or .condition1 .condition2}}
{{end}}
  • eq 等于
{{if eq .var1 .var2}}
{{end}}
  • ne 不等于
{{if ne .var1 .var2}}
{{end}}
  • lt 小于
(less than){{if lt .var1 .var2}}
{{end}}
  • le 小于等于
{{if le .var1 .var2}}
{{end}}
  • gt 大于
{{if gt .var1 .var2}}
{{end}}
  • ge 大于等于
{{if ge .var1 .var2}}
{{end}}

循环:

{{range $i, $v := .slice}}
{{end}}

引入一个模板:

{{template "navbar"}}

、红色党建风爱国主题教育班会:http://www.yomoer.cn/template/detail/7991.html

2、红色党建风年终工作总结计划汇报:http://www.yomoer.cn/template/detail/7990.html