iview+table的分页功能

iview+table的分页功能

<Table border
	: loading=" isLoading
	ref=" selection'
	: columns=" columns
	:data="tableData"
	class="myTable'
	@on- select=" selectChangeOut”
	@on-select-cance1=”selectChangeCancel"
	@on- selection- change=" onSelectCancel"
	show- header>
</Table>
<div class="pageBox" v- if=" tableData . length" >
	<Page
		: total-" parseInt( totalCount):page-size=" pageSize"
		:page -size-opts=" [10 ,20 ,30]"
		show- elevator
		show- total
		show- sizer
		@on- change=”pageChange"
		@on-page-size - change=" pageSizeChange"
	</Page>
	<p>总共{{totalPage}}</p>
</div>

后台请求的table数据太多,将table分页

export default {
	data (){
		return{
			tabledata:[],
			totalPage:0,  //共多少页
			totalCount:0, //共多少条数据
			pageNo:1,	//当前第几页
			pageSize:10,	//每页显示多少条数据
		}
	},
	methods (){
		//页码切换刷新
		searchList: function( num){
			// console. log( num) ;
			let_ this = this;
			this. isLoading=true;
			const params = {
				ip: this . formValidate. ip,
				deve.lopCenter:this.formValidate.department,
				environment: this.formValidate.taskName ,
				subSystem: this.formValidate.childName ,
				system: this.formValidate.winName,
				administrator:this.formValidate.admName,
				pageNum: this.pageNo,
				pageSize : this.pageSize 
			},
			this.$axios.post( '/mysens/senvironment',params )
			.then(function (response) {
				let userPermission = response.data.data
				_this. tableData = response.data.data.list;
				_this. totalCount = response.data.data.total;
				this. totalpage = response.data.data.pages;
				this . isLoading=false;
				// console.log( _this. tableData)
				let s1 = JSON. parse(window. sessionStorage .getItem('ids'))
				this . tableData. forEach(el => {
					s1. forEach( item => {
						// console. log(item, ' ttttttttttttttttttt')
						if(el.id == item ) {
							el._ Checked = true
							console . log( '1324567890000')
						}
					})
				})
			});
		},
		//切换页码
		pageChange: function(pageNo){
			let_ this = this;
			console . log("切换页码" , pageNo);
			this. pageNo = pageNo;
			_this. searchL ist(pageNo);
		},
		//切换页面大小
		pageSizeChange: function( pageSize){
			console . log("切换页面大小”,pageSize);
			console . log(this. pageNo);
			this . pageSize = pageSize;
			this . searchL ist(this . pageNo); 
		},

	}	
}

效果图片如下:
在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值