vue3-components-plus 3.0.16 → 3.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/ComponentDemo/NsTableDemo/index.vue +570 -564
- package/dist/ComponentDemo/NsTableDemo/mockData.js +15 -4
- package/dist/vue3-components-plus.css +1 -1
- package/dist/vue3-components-plus.js +1 -1
- package/dist/vue3-components-plus.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -503,10 +503,19 @@ import { ElMessageBox } from "element-plus";
|
|
|
503
503
|
* 根据搜索条件过滤用户数据
|
|
504
504
|
* @param {Array} users - 用户数据数组
|
|
505
505
|
* @param {Object} searchParams - 搜索参数对象
|
|
506
|
-
* @param {Object} pagination -
|
|
506
|
+
* @param {Object} pagination - 分页参数对象,支持自定义 key 名称
|
|
507
|
+
* - 默认使用 currentPage 和 pageSize
|
|
508
|
+
* - 也可传入自定义 key,如 { currentPage1: 1, pageSize1: 10 }
|
|
509
|
+
* @param {Object} keyConfig - 可选,自定义分页 key 配置
|
|
510
|
+
* - pageNumberKey: 当前页码的 key 名称,默认 'currentPage'
|
|
511
|
+
* - pageSizeKey: 每页条数的 key 名称,默认 'pageSize'
|
|
507
512
|
* @returns {Object} { list: 过滤后的用户数据, total: 总数 }
|
|
508
513
|
*/
|
|
509
|
-
export const filterUsers = (users, searchParams, pagination = {}) => {
|
|
514
|
+
export const filterUsers = (users, searchParams, pagination = {}, keyConfig = {}) => {
|
|
515
|
+
// 默认 key 配置
|
|
516
|
+
const pageNumberKey = keyConfig.pageNumberKey || 'currentPage';
|
|
517
|
+
const pageSizeKey = keyConfig.pageSizeKey || 'pageSize';
|
|
518
|
+
|
|
510
519
|
// 打印并弹出查询条件信息
|
|
511
520
|
const queryInfo = {
|
|
512
521
|
搜索条件: searchParams,
|
|
@@ -624,8 +633,10 @@ export const filterUsers = (users, searchParams, pagination = {}) => {
|
|
|
624
633
|
// 计算总数
|
|
625
634
|
const total = filteredData.length;
|
|
626
635
|
|
|
627
|
-
//
|
|
628
|
-
const
|
|
636
|
+
// 如果有分页参数,进行分页(支持自定义 key)
|
|
637
|
+
const currentPage = pagination[pageNumberKey] || 1;
|
|
638
|
+
const pageSize = pagination[pageSizeKey] || 10;
|
|
639
|
+
|
|
629
640
|
if (currentPage && pageSize) {
|
|
630
641
|
const start = (currentPage - 1) * pageSize;
|
|
631
642
|
const end = start + pageSize;
|