I get this error in vlang:
a struct must have a
next() method to be an iterator
struct Items { item []Item } struct Item { name string link string tags []string }
pub fn (mut app App) index() vweb.Result { text := os.read_file(app.db) or { panic(err) } items := json.decode(Items, text) or { panic(err) } println(items) return $vweb.html() }
index.html:
@for item in items <h2>@item.name</h2> @end
https://stackoverflow.com/questions/65822781/a-struct-must-have-a-next-method-to-be-an-iterator January 21, 2021 at 03:24PM
没有评论:
发表评论