zoukankan      html  css  js  c++  java
  • python jinja2模板分页效果

    html

        <div class="vendor-paging"><!--paging -->
          <div class='vendor-page-numbers'><!-- page button -->
            {% if vendor_page != 1 %}<a class='vendor-page-left-right page-pre' href='javascript:void(0);'><img class='left-right-image' src='/static/images/scroll_left.png'/></a>{% endif %}
            {% for i in range(1, page_total + 1) %}
              <a class='page-digital {% if vendor_page == i %}page-selected{% endif %}' href='javascript:void(0);' num="{{ i }}"><span class='page-number'>{{i}}</span></a>
            {% endfor %}
            {% if vendor_page != page_total and page_total%}<a class='vendor-page-left-right page-next' href='javascript:void(0);'><img class='left-right-image' src='/static/images/scroll_right.png'/></a>{% endif %}
          </div><!-- page button -->
          <div class="show-page-info font-s-14">
            <div class="gl-inline" style="line-height: 30px;">共{{ total }}家 ({% if total %}{{ start}}{% else %}0{% endif %}-{% if vendor_page < page_total%}{{ vendor_page * count }}{% else %}{{ total }}{% endif %}) 显示</div>
            <div class="select-style gl-inline" style=" 135px;">
            <select id="page-number" class="select">
              <option value="1" {% if count == 1 %}selected{% endif %}>1每页</option>
              <option value="20" {% if count == 20 %}selected{% endif %}>20每页</option>
              <option value="30" {% if count == 30 %}selected{% endif %}>30每页</option>
              <option value="50" {% if count == 50 %}selected{% endif %}>50每页</option>
              <option value="100" {% if count == 100 %}selected{% endif %}>100每页</option>
              <option value="250" {% if count == 250 %}selected{% endif %}>250每页</option>
            </select>
            </div>
          </div>
        </div><!--paging -->
    

    <input name="current_page" id="current_page" value={{ current_page }} type="hidden"></input>
    <input name="count" id="count" value={{ count }} type="hidden"></input>

    python

    #pagination
    current_page = int(params['current_page'])
    count = int(params['count'])
    start = (current_page - 1) * count
    params['start'] = start
    second_level_url = params['second_level_url']
    params['op'] = "getVendorProducts"
    params['count'] = count
    vendor_cars, car_total = rpc('vendor', params)
    page_total = int(ceil(float(car_total) / count))

  • 相关阅读:
    ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket
    plainless script for es
    canal 代码阅读
    elasticsearch 之编译过程
    nfs 共享目录
    canal mysql slave
    yum 运行失败
    linux 几种服务类型
    2019-04-16 SpringMVC 学习笔记
    2019-04-10 集成JasperReport
  • 原文地址:https://www.cnblogs.com/xuedong09/p/3173725.html
Copyright © 2011-2022 走看看