![](/img/trans.png)
[英]Accessing struct variable in slice of many structs in html template golang
[英]How to pass a slice of structs to template and iterate them in Golang?
我想傳遞一個包含結構 的切片 ,並在視圖中顯示所有值。
type Person struct {
ID int
NAME string
}
切片結構的示例
[{1 John},{2, Mary},{3, Steven},{4, Mike}]
我想要的index.html
1 - John
2 - Mary
3 - Steven
4 - Mike
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.