diff --git a/src/components/search/SearchMain.vue b/src/components/search/SearchMain.vue index 676093c..5886d91 100644 --- a/src/components/search/SearchMain.vue +++ b/src/components/search/SearchMain.vue @@ -401,44 +401,46 @@ export default { searchUser(offset) { this.show = false; this.load = true; - if (offset == 0) { - this.page = 1; - } - let data = { - offset: offset, - limit: 10, - }; - // 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; - } + // ตัวอย่างการดึงข้อมูลจาก API หรือแหล่งข้อมูลอื่น ๆ ตามหน้าปัจจุบันที่เลือก + const startIndex = (this.page - 1) * 10; + const endIndex = startIndex + 10; + // ในตัวอย่างนี้ จะใช้ items ของ this.items เป็นตัวอย่าง โดยใช้ฟังก์ชัน slice หรือการดึงข้อมูลจากแหล่งข้อมูล + if(this.count>0){ + this.result = this.result.slice(startIndex, endIndex); } - 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); - }); + // if (offset == 0) { + // this.page = 1; + // } + // let data = { + // offset: offset, + // limit: 90, + // }; + + // if (this.group) { + // if (this.allg !== "all") { + // data.group = this.group.id; + // } + // } + + // 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) { this.allg = checkg; @@ -451,7 +453,7 @@ export default { // this.offset = (this.page - 1) * 10; let data = { offset: offset, - limit: 10, + limit: 90, }; // if (this.province) { // data.province = this.province;