首页
Python
Java
PHP
IOS
NodeJS
JavaScript
HTML5
小程序
AI
InputError
全部标签
templates - 如何使用特定键访问该结构映射中的结构字段值
我有“FormError”结构。我将这个结构传递给我的模板。那么如何在模板中使用特定键访问InputError结构字段值呢?typeInputErrorstruct{ValstringHasbool}typeFormErrorstruct{Errsmap[string]InputError}这行不通。 最佳答案 使用{{.Errs.Name.Val}}。不需要使用索引。playgroundexample 关于templates-如何使用特定键访问该结构映射中的结构字段值,我们在Stack
射中
templates
section
code
InputError
go
go-templates
templates - 如何使用特定键访问该结构映射中的结构字段值
我有“FormError”结构。我将这个结构传递给我的模板。那么如何在模板中使用特定键访问InputError结构字段值呢?typeInputErrorstruct{ValstringHasbool}typeFormErrorstruct{Errsmap[string]InputError}这行不通。 最佳答案 使用{{.Errs.Name.Val}}。不需要使用索引。playgroundexample 关于templates-如何使用特定键访问该结构映射中的结构字段值,我们在Stack
射中
templates
section
code
InputError
go
go-templates
Home
Powered By IT.CAOLU.XIN
页面耗时:0.0509s