ZBLOG

要将分页的描述从“5/page”修改为“5条/页”,你可以调整 showTotal 函数中的字符串格式。以下是修改后的代码片段:

  1. <template>
  2. <div class="HistoricalReminder">
  3. <a-table
  4. :columns="columns"
  5. :data-source="data"
  6. :scroll="{ x: 'max-content' }"
  7. :pagination="{
  8. pageSize: pageSize,
  9. showSizeChanger: true,
  10. pageSizeOptions: ['5', '10', '20'],
  11. onShowSizeChange: handlePageSizeChange,
  12. showQuickJumper: true,
  13. showTotal: (total, range) => `显示 ${range[0]}~${range[1]}条记录,共 ${total} 条记录`
  14. }"
  15. :rowClassName="(record, index) => (index % 2 === 0 ? 'red-row' : '')"
  16. ></a-table>
  17. </div>
  18. </template>
  19. <script setup>
  20. import { ref } from 'vue';
  21. import { CollectionRecord } from '../../utils'; // 确保路径正确
  22. const columns = [
  23. {
  24. title: '借据号',
  25. dataIndex: 'loanInfoCode',
  26. key: 'loanInfoCode',
  27. width: 100,
  28. },
  29. {
  30. title: '合同编号',
  31. dataIndex: 'contractCode',
  32. key: 'contractCode',
  33. width: 150,
  34. },
  35. {
  36. title: '客户姓名',
  37. dataIndex: 'customerName',
  38. key: 'customerName',
  39. width: 150,
  40. },
  41. ];
  42. const data = ref([]);
  43. const pageSize = ref(5);
  44. const handlePageSizeChange = (current, size) => {
  45. console.log(`每页条数变化为: ${size}`);
  46. pageSize.value = size;
  47. }
  48. const params = {
  49. draw: 1,
  50. length: size,
  51. order: [],
  52. search: { regex: false, value: "" },
  53. searchParams: {
  54. custId: 'A10101',
  55. dateStart: '',
  56. dateEnd: ''
  57. },
  58. };
  59. CollectionRecord(params)
  60. .then((response) => {
  61. data.value = response.data;
  62. })
  63. .catch((error) => console.error('请求失败:', error));
  64. </script>

在上面的代码中,showTotal 函数的返回字符串已经设置为 "显示 ${range[0]}~${range[1]}条记录,共 ${total} 条记录",这样就可以确保在表格下方显示的信息符合你的要求。如果你需要更多定制化的样式或其他信息,可以根据需要进行进一步修改。


内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=19320

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?