แก้ pagination
Some checks failed
frontend-action / build-image (push) Failing after 1m37s

This commit is contained in:
2024-06-24 17:37:56 +07:00
parent 283d208791
commit aa9ee8b67d

View File

@@ -401,44 +401,46 @@ export default {
searchUser(offset) { searchUser(offset) {
this.show = false; this.show = false;
this.load = true; this.load = true;
if (offset == 0) { // ตัวอย่างการดึงข้อมูลจาก API หรือแหล่งข้อมูลอื่น ๆ ตามหน้าปัจจุบันที่เลือก
this.page = 1; const startIndex = (this.page - 1) * 10;
} const endIndex = startIndex + 10;
let data = { // ในตัวอย่างนี้ จะใช้ items ของ this.items เป็นตัวอย่าง โดยใช้ฟังก์ชัน slice หรือการดึงข้อมูลจากแหล่งข้อมูล
offset: offset, if(this.count>0){
limit: 10, this.result = this.result.slice(startIndex, endIndex); }
};
// if (this.province) {
// data.province = this.province;
// // data.province = this.province;
// }
if (this.group) {
if (this.allg !== "all") {
data.group = this.group.id;
}
}
// if (this.district) {
// data.zone = this.district;
// }
if (this.nameUser) {
data.userId = this.nameUser;
}
client.user.getAllUser // if (offset == 0) {
.query(data) // this.page = 1;
.then((rs) => { // }
this.result = rs; // let data = {
console.log(rs); // offset: offset,
this.load = false; // limit: 90,
if (rs.length == 0) { // };
this.show = true;
} // if (this.group) {
}) // if (this.allg !== "all") {
.catch((error) => { // data.group = this.group.id;
this.load = false; // }
alert("ไม่สามารถโหลดข้อมูลได้"); // }
console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error);
}); // if (this.nameUser) {
// data.userId = this.nameUser;
// }
// client.user.getAllUser
// .query(data)
// .then((rs) => {
// this.result = rs;
// console.log(rs);
// this.load = false;
// if (rs.length == 0) {
// this.show = true;
// }
// })
// .catch((error) => {
// this.load = false;
// alert("ไม่สามารถโหลดข้อมูลได้");
// console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error);
// });
}, },
searchUserApi(offset, checkg) { searchUserApi(offset, checkg) {
this.allg = checkg; this.allg = checkg;
@@ -451,7 +453,7 @@ export default {
// this.offset = (this.page - 1) * 10; // this.offset = (this.page - 1) * 10;
let data = { let data = {
offset: offset, offset: offset,
limit: 10, limit: 90,
}; };
// if (this.province) { // if (this.province) {
// data.province = this.province; // data.province = this.province;