{{if eq 0 $.ParentId}} selected{{end}}
上面这个在和数据库变量比的时候,有时候会报错,把0换成range的变量的时候
报错信息为:
at <eq .ID $.ParentId
>: error calling eq: incompatible types for comparison
然后用下面的代码替换即可:
{{if compare .ID $.ParentId}} selected{{end}}