guhongwei 5 years ago
parent
commit
085fc49c63
1 changed files with 19 additions and 1 deletions
  1. 19 1
      src/views/news-list/index.vue

+ 19 - 1
src/views/news-list/index.vue

@@ -17,7 +17,16 @@
               </li>
             </ul>
           </div>
-          <div class="newlistpage">分页</div>
+          <div class="newlistpage">
+            <el-pagination
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="currentPage"
+              layout="total, prev, pager, next, jumper"
+              :total="total"
+            >
+            </el-pagination>
+          </div>
         </div>
       </div>
     </div>
@@ -35,6 +44,8 @@ export default {
   data: () => {
     return {
       list: [],
+      total: 0,
+      currentPage: 1,
     };
   },
   created() {
@@ -54,6 +65,13 @@ export default {
         res = await this.query({ skip, limit, column_name: '教育培训', ...info });
       }
       if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+      this.$set(this, `total`, res.total);
+    },
+    handleSizeChange(val) {
+      console.log(`每页 ${val} 条`);
+    },
+    handleCurrentChange(val) {
+      console.log(`当前页: ${val}`);
     },
   },
   computed: {