PageAdmin网站内容管理系统(CMS)交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

怎么增加自定义显示每页多少条 [复制链接]

1#
在新闻列表页面的底部,可以选择每页显示多少条,该怎么写

想达到这个图的效果
最后编辑李木木 最后编辑于 2022-03-10 11:18:10
分享 转发
TOP
2#

回复 1楼李木木的帖子
  1. <div class="text-center padding-20" style="text-align: right;padding: 20px 0px 20px 20px;">
  2.         <ul class="pagination">
  3.       <span class="lb_recordcount input- group - addon">共 @pageInfo.RecordCount 条</span>
  4.             @{
  5.                 if (currentPage > 1)
  6.                 {
  7.                     <li>
  8.                         <a href="@Pagebreak(currentPage-1,urlPrefix,urlParams)"><</a>
  9.                     </li>
  10.                 }
  11.                 else
  12.                 {
  13.                     <li class="disabled">
  14.                         <a><</a>
  15.                     </li>
  16.                 }
  17.                 int startPage = currentPage - m;
  18.                 int lastPage = currentPage + m;
  19.                 int cha = 0;
  20.                 if (lastPage > pageCount)
  21.                 {
  22.                     cha = lastPage - pageCount;
  23.                     startPage = startPage - cha;
  24.                     if (startPage < 1)
  25.                     {
  26.                         startPage = 1;
  27.                     }
  28.                     lastPage = pageCount;
  29.                 }
  30.                 else if (startPage < 1)
  31.                 {
  32.                     cha = 1 - startPage;
  33.                     startPage = startPage + cha;
  34.                     lastPage = lastPage + cha;
  35.                     if (lastPage > pageCount)
  36.                     {
  37.                         lastPage = pageCount;
  38.                     }
  39.                 }
  40.                 if (startPage > 1)
  41.                 {
  42.                     <li><a href="@Pagebreak(1,urlPrefix,urlParams)">1 ...</a></li>
  43.                 }
  44.                 for (int i = startPage; i <= lastPage; i++)
  45.                 {
  46.                     <li@(currentPage==i?" class=active":"")>
  47.                         <a href="@Pagebreak(i,urlPrefix,urlParams)">@i</a></li>
  48.                     }
  49.                     if (lastPage < pageCount)
  50.                     {
  51.                         <li><a href="@Pagebreak(pageCount,urlPrefix,urlParams)" )>... @pageCount</a></li>
  52.                     }
  53.                     if (currentPage < pageCount)
  54.                     {
  55.                         <li>
  56.                             <a href="@Pagebreak(currentPage+1,urlPrefix,urlParams)">></a>
  57.                         </li>
  58.                     }
  59.                     else
  60.                     {
  61.                         <li class="disabled">
  62.                             <a>></a>
  63.                         </li>
  64.                     }
  65.             }
  66.     </ul>
  67. </div>
复制代码
这是现在底部的代码
TOP
3#

不是改这个文件,应该改列表页模板 里面有一个PageInfo的对象,参考实例帮助:https://www.pageadmin.net/help/38.cshtml
TOP
4#

回复 3楼xiyou的帖子

好的,我研究研究
TOP
5#

试试这个?https://element.eleme.cn/#/zh-CN ... on#fu-jia-gong-neng
样式可以自己随便写。程序也都是现成的,只是目前使用在后台。

最后编辑xuline 最后编辑于 2022-03-12 21:24:51
TOP
6#

回复 5楼xuline的帖子

非常有参考价值!感谢笔芯
TOP
发新话题 回复该主题