Skip to content

Commit

Permalink
fix: fix mock search
Browse files Browse the repository at this point in the history
  • Loading branch information
Areo-Joe committed Oct 16, 2024
1 parent b6d148b commit cc9c9d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions miniprogram/tcb-shop/services/good/spu.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ const SKU_MODEL_KEY = DATA_MODEL_KEY.SKU;
*/
export async function listGood({ pageSize, pageNumber, search }) {
if (cloudbaseTemplateConfig.useMock) {
const records = search ? SPU.filter((x) => x.name.includes(search)) : SPU;
const startIndex = (pageNumber - 1) * pageSize;
const endIndex = startIndex + pageSize;
return {
records: SPU,
total: SPU.length,
records: records.slice(startIndex, endIndex),
total: records.length,
};
}
const filter = {
Expand Down

0 comments on commit cc9c9d5

Please sign in to comment.