vue實(shí)現(xiàn)表格分頁(yè)功能
本文實(shí)例為大家分享了vue實(shí)現(xiàn)表格分頁(yè)功能的具體代碼,供大家參考,具體內(nèi)容如下
直接上代碼:
這里是這里是template部分,主要由一個(gè)需要分頁(yè)的表格和一個(gè)分頁(yè)器組成。重點(diǎn)在于表格的data屬性用到了一個(gè)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="序號(hào)" 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="成功邀請(qǐng)人數(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> <!-- 分頁(yè)器 --> <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)前頁(yè)碼 pageSize:10//每頁(yè)顯示條數(shù) list:[]//要顯示的表格數(shù)據(jù) } } methods{ handleCurrentChange(val) { this.currentPage = val; }, } }
實(shí)現(xiàn)如圖效果
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- vuejs實(shí)現(xiàn)本地?cái)?shù)據(jù)的篩選分頁(yè)功能思路詳解
- Vue2.5 結(jié)合 Element UI 之 Table 和 Pagination 組件實(shí)現(xiàn)分頁(yè)功能
- Vue+element-ui 實(shí)現(xiàn)表格的分頁(yè)功能示例
- vue+vuex+json-seiver實(shí)現(xiàn)數(shù)據(jù)展示+分頁(yè)功能
- vue實(shí)現(xiàn)的上拉加載更多數(shù)據(jù)/分頁(yè)功能示例
- vue+elementUI組件table實(shí)現(xiàn)前端分頁(yè)功能
- vue實(shí)現(xiàn)分頁(yè)功能
- vue實(shí)現(xiàn)簡(jiǎn)單分頁(yè)功能
- vue實(shí)現(xiàn)簡(jiǎn)單的分頁(yè)功能
- vue iview實(shí)現(xiàn)分頁(yè)功能
- vue實(shí)現(xiàn)一個(gè)簡(jiǎn)單的分頁(yè)功能實(shí)例詳解
相關(guān)文章
vue實(shí)現(xiàn)的封裝全局filter并統(tǒng)一管理操作示例
這篇文章主要介紹了vue實(shí)現(xiàn)的封裝全局filter并統(tǒng)一管理操作,結(jié)合實(shí)例形式詳細(xì)分析了vue封裝全局filter及相關(guān)使用技巧,需要的朋友可以參考下2020-02-02Vue2.0仿餓了么webapp單頁(yè)面應(yīng)用詳細(xì)步驟
本篇文章給大家分享了Vue2.0仿餓了么webapp單頁(yè)面應(yīng)用詳細(xì)步驟,有興趣的朋友可以跟著操作下。2018-07-07vue 項(xiàng)目中的this.$get,this.$post等$的用法案例詳解
vue.js的插件應(yīng)該暴露一個(gè)install方法。這個(gè)方法的第一個(gè)參數(shù)是vue構(gòu)造器,第二個(gè)參數(shù)是一個(gè)可選的選項(xiàng)對(duì)象,首頁(yè)要安裝axios,本文結(jié)合案例代碼給大家詳細(xì)講解vue 中的this.$get,this.$post等$的用法,一起學(xué)習(xí)下吧2022-12-12淺談vue單頁(yè)面中有多個(gè)echarts圖表時(shí)的公用代碼寫(xiě)法
這篇文章主要介紹了淺談vue單頁(yè)面中有多個(gè)echarts圖表時(shí)的公用代碼寫(xiě)法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-07-07vue 實(shí)現(xiàn)把路由單獨(dú)分離出來(lái)
這篇文章主要介紹了vue 實(shí)現(xiàn)把路由單獨(dú)分離出來(lái),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-08-08vue計(jì)算屬性computed--getter和setter用法
這篇文章主要介紹了vue計(jì)算屬性computed--getter和setter用法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-01-01