折雨的天空
beego中range中使用根变量,报错:at <.basePath>: can't evaluate field basePath in type int
2019-7-26 我好笨
o 统一使用了 {{ 和 }} 作为左右标签,没有其他的标签符号。如果您想要修改为其它符号,可以参考 模板标签。

使用 . 来访问当前位置的上下文

使用 $ 来引用当前模板根级的上下文

使用 $var 来访问创建的变量










看下面代码的basePath







<div class="am-fr">
<ul class="am-pagination tpl-pagination">
<li class=""><a href="###" onclick="ajax_page('{{$.basePath}}manage/user?page={{.paginator.firstpage}}')">«</a></li>
{{range $index,$page := .paginator.pages}}
<li {{if eq $.paginator.currpage $page }}class="am-active"{{end}}>
<a href="###" onclick="ajax_page('{{$.basePath}}manage/user?page={{$page}}')">{{$page}}</a></li>
{{end}}
<li><a href="###" onclick="ajax_page('{{$.basePath}}manage/user?page={{.paginator.lastpage}}')">»</a></li>
</ul>
</div>



发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容