component.scheme.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'
  2. export const propsScheme = {
  3. currentPage: {
  4. type: Number,
  5. intro: '当前页数',
  6. default: 1
  7. },
  8. total: {
  9. type: Number,
  10. intro: '总条目数',
  11. default: 0
  12. },
  13. limit: {
  14. type: Number,
  15. intro: '每页显示条目数',
  16. default: 10
  17. },
  18. offset: {
  19. type: Number,
  20. intro: '(props.currentPage - 1) * size',
  21. default: 0
  22. },
  23. hideOnSinglePage: {
  24. type: Boolean,
  25. intro: '只有一页时是否隐藏'
  26. },
  27. layout: {
  28. type: String,
  29. intro: '组件布局,子组件名用逗号分隔',
  30. default: 'total, sizes, prev, pager, next, jumper'
  31. },
  32. background: {
  33. type: Boolean,
  34. intro: '是否为分页按钮添加背景色',
  35. default: true
  36. },
  37. pageSizes: {
  38. type: Array,
  39. intro: '每页显示个数选择器的选项设置',
  40. default: [5, 8, 10, 15, 20]
  41. },
  42. small: {
  43. type: Boolean,
  44. intro: '是否使用小型分页样式',
  45. default: false,
  46. attr: true
  47. },
  48. pagerCount: {
  49. type: Number,
  50. intro: '设置最大页码按钮数。 页码按钮的数量,当总页数超过该值时会折叠',
  51. options: '5 ≤ x ≤ 21 的奇数',
  52. default: 7,
  53. attr: true
  54. },
  55. popperClass: {
  56. type: String,
  57. intro: '每页显示个数选择器的下拉框类名',
  58. attr: true
  59. },
  60. prevText: {
  61. type: String,
  62. intro: '替代图标显示的上一页文字',
  63. attr: true
  64. },
  65. prevIcon: {
  66. type: Object,
  67. intro: '上一页的图标, 比 prev-text 优先级更高',
  68. default: ArrowLeft,
  69. attr: true
  70. },
  71. nextText: {
  72. type: String,
  73. intro: '替代图标显示的下一页文字',
  74. attr: true
  75. },
  76. nextIcon: {
  77. type: Object,
  78. intro: '下一页的图标, 比 prev-text 优先级更高',
  79. default: ArrowRight,
  80. attr: true
  81. },
  82. disabled: {
  83. type: Boolean,
  84. intro: '是否禁用分页',
  85. default: false,
  86. attr: true
  87. }
  88. }
  89. export const eventsScheme = {
  90. 'update:limit': {
  91. intro: '每页条数变化时触发',
  92. cbVar: '新每页条数'
  93. },
  94. 'update:offset': {
  95. intro: '当前页变化时触发',
  96. cbVar: '(props.currentPage - 1) * size'
  97. },
  98. refresh: {
  99. intro: '每页条数变化、当前页变化时触发',
  100. cbVar: 'offset(只有当前页变化时存在)'
  101. }
  102. }
  103. export const componentScheme = {
  104. propsScheme,
  105. eventsScheme
  106. }