🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## beego分页类 原 go ~~~ count, _ := models.M("logoperation").Alias(`op`).Field(`count(op.id) as count`).Where(where).Count() if count > 0 { pagesize := 10 p := tools.NewPaginator(this.Ctx.Request, pagesize, count) log, _ := models.M("logoperation").Alias(`op`).Where(where).Limit(strconv.Itoa(p.Offset()), strconv.Itoa(pagesize)).Order(`op.id desc`).Select() this.Data["data"] = log this.Data["paginator"] = p } ~~~ 模板 ~~~ <div style="text-align:center;padding-left: 100px;margin-top: -24px;float: right;" class="pagination"> {{if .paginator}} {{if gt .paginator.PageNums 1}} <ul class="pagination pagination-sm"> {{if .paginator.HasPrev}} <li> <a href="{{.paginator.PageLinkFirst}}">首页</a> </li> <li> <a href="{{.paginator.PageLinkPrev}}">上一页</a> </li> {{else}} <li class="disabled"> <a>首页</a> </li> <li class="disabled"> <a>上一页</a> </li> {{end}} {{range $index, $page := .paginator.Pages}} <li{{if $.paginator.IsActive .}} class="active"{{end}}> <a href="{{$.paginator.PageLink $page}}">{{$page}}</a> </li> {{end}} {{if .paginator.HasNext}} <li> <a href="{{.paginator.PageLinkNext}}">下一页</a> </li> <li> <a href="{{.paginator.PageLinkLast}}">末页</a> </li> {{else}} <li class="disabled"> <a>下一页</a> </li> <li class="disabled"> <a>末页</a> </li> {{end}} <li class="disabled"> <a> 共{{.paginator.Nums }}条数据 每页{{.paginator.PerPageNums}}条 当前{{.paginator.Page}}/{{.paginator.PageNums}}页 </a> </li> <li> <input type="text" id="tiaozhuan" placeholder="跳转页" style="width: 47px;height: 30px;border: 1px solid #dddddd;border-left: 0px;border-radius: 0px 4px 4px 0px;text-align: center;"></li> </ul> {{end}} {{end}} </div> ~~~