有没有一种方法可以用goview在echo中将字符串呈现为html模板?

时间:2020-05-29 09:42:31

标签: go echo

在echo框架中

func GetIndex(c echo.Context) error {
    return c.Render(http.StatusOK, "index", echo.Map{"Title": index})
}

func main() {
     e := echo.New()
     e.Renderer = echoview.Default()
     ....

     e.GET("/index", GetIndex)
     e.Logger.Fatal(e.Start(":1323"))
}

我想要的是从另一个包含{{something}}的函数传递的字符串到

c.Render(http.StatusOK, "index", echo.Map{"Title": index, "Template": ??? })

示例:

{{define}}
    This string is generate by another function {{.Title}}
{{end}}

有什么办法吗?

0 个答案:

没有答案