Gin路由中相应数据 c.HTML()
{{define "default/index.html"}} {{end}} news.html {{define "default/news.html"}} <! DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < title > Document </ title > </ head > < body > < h2 > {{.title}} </ h2 > < p > {{.news.Title}} </ p > < p > {{.news.Content}} </ p > </ body > </ html > {{end}} main.go package main import ( "github.com/gin-gonic/gin" "net/http" ) type Aritle struct { Title string Content string } func main () { r := gin. Default () r. LoadHTMLGlob ( "templates/**/*" ) // r.GET("/123", func(c...