vue笔记


Table of Contents

vue分页

需要参数:

  • page: 当前页码
  • total_page: 总页数

代码片段

<ul class="pagination" v-if="total_page > 1">
  <li  v-if="page > 1" class="previous">
    <a href="javascript:void(0);" v-on:click="paginate_to(1);">«</a>
  </li>
  <template v-for="p in total_page">
    <template v-if="p == page">
      <li class="active">
        <a href="javascript:void(0);">{{ p }}</a>
      </li>
    </template>
    <template v-else-if="(page - 2 < p && p < page + 2) || p …