From e05781963d5fa73da5c2bea486234fa42d131fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Tue, 9 Aug 2022 01:16:24 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(component):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20table=20=E5=B7=A5=E5=85=B7=E6=A0=8F=20dropdown=20=E9=9A=8F?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=9D=A1=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/table/index.vue | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/package/component/src/component/table/index.vue b/package/component/src/component/table/index.vue index bc570e9b..31773f4c 100644 --- a/package/component/src/component/table/index.vue +++ b/package/component/src/component/table/index.vue @@ -97,7 +97,7 @@ const tableHeadColumns = ref([]); const tableBodyColumns = ref([]); /** - * 获取数组深度 + * 获取数组深度 * * @param arr 数组 */ @@ -120,8 +120,8 @@ const getLevel = (arr: any[]) => { /** * 获取叶节点的数量 - * - * @param json 当前节点 + * + * @param json 当前节点 */ function getLeafCountTree(json: any) { if (!json.children || json.children.length == 0) { @@ -139,8 +139,8 @@ function getLeafCountTree(json: any) { /** * 计算内容列 - * - * @param columns 原始列 + * + * @param columns 原始列 */ const findFindNode = (columns: any[]) => { columns.forEach((column) => { @@ -156,8 +156,8 @@ findFindNode(tableColumns.value); /** * 计算显示列 - * - * @param columns 原始列 + * + * @param columns 原始列 */ const tableColumnKeys = ref([]); @@ -178,21 +178,21 @@ findFindNodes(tableColumns.value); /** * 计算数组差异 - * + * * @param arr1 数组 - * @param arr2 数组 + * @param arr2 数组 */ function diff(arr1: any[], arr2: any[]) { - var newArr = []; - arr1 = Array.from(new Set(arr1)); // 去重 - arr2 = Array.from(new Set(arr2)); // 去重 - newArr =arr1.concat(arr2); - return newArr.filter(x=>!(arr1.includes(x) && arr2.includes(x))) + var newArr = []; + arr1 = Array.from(new Set(arr1)); // 去重 + arr2 = Array.from(new Set(arr2)); // 去重 + newArr = arr1.concat(arr2); + return newArr.filter((x) => !(arr1.includes(x) && arr2.includes(x))); } /** * 计算标题列 - * + * * @param level 层级, 用于决定会被 push 到的目标数组 */ const findFinalNode = (level: number, columns: any[]) => { @@ -560,7 +560,7 @@ const renderTotalRowCell = (column: any) => {
- +
@@ -618,7 +618,12 @@ const renderTotalRowCell = (column: any) => { -