<template> <div id="app"> <el-card> <!-- 表格 --> <div id="table"> <el-table :data="news.slice((currentPage - 1) * pageSize, currentPage * pageSize)" tooltip-effect="dark"> <el-table-column type="selection" width="55" > </el-table-column> <el-table-column prop="news_time" label="发送时间" width="120"> </el-table-column> <el-table-column prop="news_sender" label="发送人" width="120"> </el-table-column> <el-table-column prop="news_state" label="状态" width="120"> </el-table-column> <el-table-column prop="news_content" label="内容"> </el-table-column> <el-table-column fixed="right" label="操作" width="100"> <template slot-scope="scope"> <el-button @click="check" type="text" size="small"> 查看 </el-button> </template> </el-table-column> </el-table> </div> <!-- 分页 --> <div class="block"> <el-pagination :current-page.sync="currentPage" :page-size="8" layout="total, prev, pager, next" :total="news.length"> </el-pagination> </div> </el-card> </div> </template> <script> export default { name: 'user_news', data() { return {// 消息 news: [], // 一页显示多少 pageSize: 8, // 页数 currentPage: 1, } }, } </script>
标签:return,分页,实现,element,default,export,news From: https://www.cnblogs.com/liweimingbk/p/17069288.html