1.计算公式

offset=page*limit-limit

2.代码

/**
 * 分页查询
 * @param offset 起始页
 * @param limit 每页展示条数
 * offset=page*limit-limit
 */
const query = {
  offset: app.toInt(pageNum) * app.toInt(pageSize) - app.toInt(pageSize),
  limit: app.toInt(pageSize)
};
return await app.model.Diary.findAndCountAll({ ...query, raw: true });

.

 

相关文章:

  • 2022-01-01
  • 2022-01-01
  • 2022-01-01
  • 2020-04-07
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2021-08-22
  • 2021-11-13
  • 2021-11-13
  • 2021-11-13
相关资源
相似解决方案