赞
踩
Vue从入门到精通学习笔记
<n-data-table
remote
ref="table"
:columns="columns"
:data="data"
:loading="loading"
:pagination="pagination"
:row-key="rowKey"
@update:page="handlePageChange"
/>
function query (page, pageSize = 10 ,apiName ="",apiFlag ="",apiStatus="",apiPath="") { return new Promise((resolve) => { const url ='/interface/getList' const params = { "pageNum": page, "pageSize": pageSize, "apiName": apiName, "apiFlag": apiFlag, "apiStatus": apiStatus, "apiPath": apiPath, "order": "api_create_time", "sort": "desc" } axios.post(url,params) .then(function (response) { console.log(response); TableData.apiList=response.data.data; TableData.totalNum=response.data.totalNum; console.log(TableData.apiList); console.log(TableData.totalNum); const copiedData = TableData.apiList.map((v) => v) const total = TableData.totalNum const pageCount = Math.ceil(total / pageSize) setTimeout( () => resolve({ pageCount, data: copiedData, total }), 1500 ) }) .catch(function (error) { console.log(error); }); }) }
默认请求的pageSize为10条,通过返回数据的total确定页数,再次查询时动态改变pageNum,以及其他参数。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。