https://github.com/metafizzy/infinite-scroll
{% block content %}
<table class="me-table me-table-bordered">
<col width="35%"/>
<col width="35%"/>
<col width="30%"/>
<thead>
<tr class="">
<th class="">单号</th>
<th class="">金额</th>
<th class="">状态</th>
</tr>
</thead>
<tbody class="orders">
{% for order in orders %}
<tr class="order">
<td>{{ order.number }}</td>
<td>{{ order.amount}}</td>
<td>
{% if order.state == 0 %}
待付款
{% elif order.state == 1 %}
已付款
{% elif order.state == 2 %}
已取消
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block js %}
<script src="https://unpkg.com/infinite-scroll@3/dist/infinite-scroll.pkgd.min.js"></script>
<script>
var infScroll = new InfiniteScroll('.orders', {
path: '/order?page=\{\{\#\}\}',
append: '.order',
debug: true,
});
</script>
{% endblock %}
@blueprint.route('/order', methods=['GET'])
@login_required
def order():
page = request.args.get('page', 1, type=int)
pagination = Order.query.filter(Order.user_id == current_user.id).paginate(page, per_page=30, error_out=False)
orders = pagination.items
return render_template('order.html', orders=orders, pagination=pagination)
一直没有反应,请指教下如何使用,非常感谢!
1
MrGba2z 2018-06-15 12:16:47 +08:00
后台没收到 request?那就是 js 没发
先看看是哪边的问题 |