php 查询数据点下一页,分页条件查询点击下一页后变成全部数据?

本文探讨了一个包含大量数据的table表格,在实现搜索筛选功能后遇到的问题:即搜索后翻页会显示全部数据而非筛选结果。文章通过示例代码展示了当前实现方式,并提出了解决这一问题的需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一个页面有table表格, 里面有很多数据, 有搜索框, 当点击搜索的时候, 可以进行筛选, 但是点击下一页的时候, 数据变成全部的数据, 分页也跟着变了

以下是点击搜索的时候筛选的数据

bV78pU?w=1464&h=643

3.当点击下一页的时候数据变成全部数据

bV78qD?w=1444&h=627

js

export default {

data() {

return {

botanyData: [],

activeName2: "first",

query: {

pageNum: 1,

pageSize: 10,

currentPage: 1,

recordCount: 0

},

seek: {

familyName: "",

speciesName: "",

genusName: ""

},

familyName: "",

speciesName: "",

genusName: ""

};

},

methods: {

// 植物数据

wildPlantData() {

this.$http

.get(this.$api.wildPlant, {

params: { pageNum: this.query.currentPage }

})

.then(res => {

if (res.status == 200) {

this.botanyData = res.data.data.pageBean.recordList;

this.query.recordCount = res.data.data.pageBean.recordCount;

this.query.pageSize = res.data.data.pageBean.pageSize;

this.query.currentPage = res.data.data.pageBean.currentPage;

} else {

throw res.message;

}

})

.catch(err => {

console.log("wildPlantData有异常", err);

});

},

// 查询

queryData() {

this.seek.familyName = this.familyName;

this.seek.speciesName = this.speciesName;

this.seek.genusName = this.genusName;

this.$http

.get(this.$api.wildPlant, { params: this.seek })

.then(res => {

if (res.status == 200) {

this.botanyData = res.data.data.pageBean.recordList;

this.query.recordCount = res.data.data.pageBean.recordCount;

this.query.pageSize = res.data.data.pageBean.pageSize;

this.query.currentPage = res.data.data.pageBean.currentPage;

} else {

throw res.message;

}

})

.catch(err => {

console.log("queryData有异常", err);

});

},

// 分页

handleSizeChange(val) {},

handleCurrentChange(pageNum) {

this.query.currentPage = pageNum;

this.wildPlantData();

}

},

created() {

this.wildPlantData();

this.queryData();

}

};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值