vue實現(xiàn)表格分頁功能
本文實例為大家分享了vue實現(xiàn)表格分頁功能的具體代碼,供大家參考,具體內(nèi)容如下
直接上代碼:
這里是這里是template部分,主要由一個需要分頁的表格和一個分頁器組成。重點在于表格的data屬性用到了一個slice截取方法。
<el-table v-loading="listLoading" :data=" list.slice((currentPage - 1) * pageSize, currentPage * pageSize) " element-loading-text="Loading" highlight-current-row border > <el-table-column align="center" label="序號" width="90"> <template slot-scope="scope"> {{ scope.$index + 1 }} </template> </el-table-column> <el-table-column label="頭像" align="center" width="150"> <template slot-scope="scope"> <el-avatar :src="scope.row.avatar"></el-avatar> </template> </el-table-column> <el-table-column align="center" label="UID" width="130"> <template slot-scope="scope"> {{ scope.row.UID }} </template> </el-table-column> <el-table-column align="center" label="用戶名" width="350"> <template slot-scope="scope"> {{ scope.row.username }} </template> </el-table-column> <el-table-column align="center" label="游戲ID" width="350"> <template slot-scope="scope"> {{ scope.row.usernick }} </template> </el-table-column> <el-table-column label="授權(quán)類型" width="110" align="center"> <template slot-scope="scope"> <el-tag :type="scope.row.authorizationType | tagTypeFilter">{{ scope.row.authorizationType | authorizationTypeFilter }}</el-tag> </template> </el-table-column> <el-table-column align="center" label="成功邀請人數(shù)" width="150"> <template slot-scope="scope">{{ scope.row.successNum }} </template> </el-table-column> <!-- <el-table-column align="center" label="操作" width="150"> <template slot-scope="scope"> <el-button type="primary" size="mini" @click="change(scope.$index, scope.row)" > 修改 </el-button> </template> </el-table-column> --> </el-table> <!-- 分頁器 --> <div class="block" style="margin-top: 15px"> <el-pagination align="right" @current-change="handleCurrentChange" :current-page="currentPage" :page-size="pageSize" layout="prev, pager, next,total" background :total="filterList.length" hide-on-single-page > </el-pagination> </div>
這里是javascript部分:
export default{ data(){ return{ currentPage:1//當(dāng)前頁碼 pageSize:10//每頁顯示條數(shù) list:[]//要顯示的表格數(shù)據(jù) } } methods{ handleCurrentChange(val) { this.currentPage = val; }, } }
實現(xiàn)如圖效果
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- vuejs實現(xiàn)本地數(shù)據(jù)的篩選分頁功能思路詳解
- Vue2.5 結(jié)合 Element UI 之 Table 和 Pagination 組件實現(xiàn)分頁功能
- Vue+element-ui 實現(xiàn)表格的分頁功能示例
- vue+vuex+json-seiver實現(xiàn)數(shù)據(jù)展示+分頁功能
- vue實現(xiàn)的上拉加載更多數(shù)據(jù)/分頁功能示例
- vue+elementUI組件table實現(xiàn)前端分頁功能
- vue實現(xiàn)分頁功能
- vue實現(xiàn)簡單分頁功能
- vue實現(xiàn)簡單的分頁功能
- vue iview實現(xiàn)分頁功能
- vue實現(xiàn)一個簡單的分頁功能實例詳解
相關(guān)文章
vue實現(xiàn)的封裝全局filter并統(tǒng)一管理操作示例
這篇文章主要介紹了vue實現(xiàn)的封裝全局filter并統(tǒng)一管理操作,結(jié)合實例形式詳細(xì)分析了vue封裝全局filter及相關(guān)使用技巧,需要的朋友可以參考下2020-02-02Vue2.0仿餓了么webapp單頁面應(yīng)用詳細(xì)步驟
本篇文章給大家分享了Vue2.0仿餓了么webapp單頁面應(yīng)用詳細(xì)步驟,有興趣的朋友可以跟著操作下。2018-07-07vue 項目中的this.$get,this.$post等$的用法案例詳解
vue.js的插件應(yīng)該暴露一個install方法。這個方法的第一個參數(shù)是vue構(gòu)造器,第二個參數(shù)是一個可選的選項對象,首頁要安裝axios,本文結(jié)合案例代碼給大家詳細(xì)講解vue 中的this.$get,this.$post等$的用法,一起學(xué)習(xí)下吧2022-12-12vue計算屬性computed--getter和setter用法
這篇文章主要介紹了vue計算屬性computed--getter和setter用法,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-01-01