Documentation ¶
Index ¶
- Variables
- type ViewHandler
- func (h *ViewHandler) GinRouter(r *gin.Engine, prefix string)
- func (h *ViewHandler) GinRouterJump(r *gin.Engine, prefix string)
- func (h *ViewHandler) InitiateRender()
- func (h *ViewHandler) LayoutFilePrefix() string
- func (h *ViewHandler) Render() render.HTMLRender
- func (h *ViewHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *ViewHandler) ViewForGin(ctx *gin.Context)
- type ViewHandlerConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultViewHandlerConfig = ViewHandlerConfig{
ParamName: "name",
}
DefaultViewHandlerConfig 默认配置
Functions ¶
This section is empty.
Types ¶
type ViewHandler ¶
type ViewHandler struct { ViewHandlerConfig v1log.InvokeLog // contains filtered or unexported fields }
ViewHandler viewHandler
func NewViewHandler ¶
func NewViewHandler(cnf ViewHandlerConfig) *ViewHandler
func (*ViewHandler) GinRouter ¶
func (h *ViewHandler) GinRouter(r *gin.Engine, prefix string)
GinRouter 推荐的ginRouter配置
func (*ViewHandler) GinRouterJump ¶
func (h *ViewHandler) GinRouterJump(r *gin.Engine, prefix string)
func (*ViewHandler) LayoutFilePrefix ¶
func (h *ViewHandler) LayoutFilePrefix() string
LayoutFilePrefix 布局文件前缀
func (*ViewHandler) Render ¶
func (h *ViewHandler) Render() render.HTMLRender
func (*ViewHandler) ServeHTTP ¶
func (h *ViewHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ViewHandler) ViewForGin ¶
func (h *ViewHandler) ViewForGin(ctx *gin.Context)
type ViewHandlerConfig ¶
type ViewHandlerConfig struct { ViewFs embed.FS //模板渲染的viewFs ViewDir string //模板渲染所在目录 FuncMaps []template.FuncMap //模板文件迁入的函数map ParamName string //获取view渲染模板名称的参数名(如name) ParamFunc func(r *http.Request) string //定制化获取view渲染模板名称的方法(不存在则默认方式获取) OptionLayoutFlag string //布局文件前缀标志 }
ViewHandlerConfig viewHandler配置
Click to show internal directories.
Click to hide internal directories.