diff --git a/src/components/search/SearchMain.vue b/src/components/search/SearchMain.vue index d388234..c1b0264 100644 --- a/src/components/search/SearchMain.vue +++ b/src/components/search/SearchMain.vue @@ -373,7 +373,7 @@ export default { }, searchUser() { this.show = false; - this.load = true; + // this.load = true; // ตัวอย่างการดึงข้อมูลจาก API หรือแหล่งข้อมูลอื่น ๆ ตามหน้าปัจจุบันที่เลือก const startIndex = (this.page - 1) * 10; const endIndex = startIndex + 10; @@ -415,7 +415,7 @@ export default { // console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); // }); }, - searchUserApi(offset, checkg) { + searchUserApi(checkg) { this.allg = checkg; this.searchGroup = this.group this.show = false; @@ -425,7 +425,6 @@ export default { } // this.offset = (this.page - 1) * 10; let data = { - offset: offset, limit: 90, }; // if (this.province) { @@ -460,8 +459,8 @@ export default { console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); }); - const startIndex = (this.page - 1) * 10; - const endIndex = startIndex + 10; + const startIndex = (this.page - 1) * 10; + const endIndex = startIndex + 10; client.user.getAllUser .query(data) .then((rs) => { @@ -470,6 +469,9 @@ export default { this.load = false; if (rs.length == 0) { this.show = true; + + }else{ + this.result = [...rs].slice(startIndex, endIndex); } }) @@ -480,8 +482,7 @@ export default { }); // ในตัวอย่างนี้ จะใช้ items ของ this.items เป็นตัวอย่าง โดยใช้ฟังก์ชัน slice หรือการดึงข้อมูลจากแหล่งข้อมูล - if(this.count>0){ - this.result = [...this.resultdata].slice(startIndex, endIndex); } + }, filterData() {