, "b", gin.H{ "title": "gin框架之HTML模板渲染-b", }) }) router.Run(":8080")}
a.html
{{/*定义模板名称为a...例如
//加载名称为a的模板,并给模板赋值 c.HTML(http.StatusOK, "a", gin.H{ "title": "gin框架之HTML模板渲染-a",..., "b", gin.H{ "title": "gin框架之HTML模板渲染-b", }) }) router.GET("/func", func(c *gin.Context) {...//定义模板,并给模板赋值 c.HTML(http.StatusOK, "func", gin.H{ "title": "gin框架之HTML模板渲染- ", }) })...HTML模板渲染- myFunc