From 36323688bb66d9375c31b01c6f94b8e4b5a5d2e2 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: Wed, 29 Jun 2022 10:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D(component):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/component/table/TableRow.vue | 80 ++++++++++++------- .../component/src/component/table/index.vue | 2 +- package/component/src/provider/index.vue | 4 +- .../src/document/zh-CN/components/table.md | 54 +++++++++++++ .../src/document/zh-CN/guide/changelog.md | 14 ++++ 5 files changed, 121 insertions(+), 33 deletions(-) diff --git a/package/component/src/component/table/TableRow.vue b/package/component/src/component/table/TableRow.vue index 3257358b..50bd04ec 100644 --- a/package/component/src/component/table/TableRow.vue +++ b/package/component/src/component/table/TableRow.vue @@ -41,7 +41,7 @@ const props = withDefaults(defineProps(), { checkbox: false, childrenColumnName: "children", cellStyle: "", - cellClassName: "" + cellClassName: "", }); const tableSelectedKeys: WritableComputedRef = computed({ @@ -82,33 +82,43 @@ const handleExpand = () => { isExpand.value = !isExpand.value; }; -const renderCellStyle = (row: any, column: any, rowIndex: number, columnIndex: number) => { - if(typeof props.cellStyle === 'string') { +const renderCellStyle = ( + row: any, + column: any, + rowIndex: number, + columnIndex: number +) => { + if (typeof props.cellStyle === "string") { return props.cellStyle; - } + } return props.cellStyle(row, column, rowIndex, columnIndex); -} +}; -const renderCellClassName = (row: any, column: any, rowIndex: number, columnIndex: number) => { - if(typeof props.cellClassName === 'string') { +const renderCellClassName = ( + row: any, + column: any, + rowIndex: number, + columnIndex: number +) => { + if (typeof props.cellClassName === "string") { return props.cellClassName; - } - return props.cellClassName(row, column, rowIndex, columnIndex); -} + } + return props.cellClassName(row, column, rowIndex, columnIndex); +}; const renderRowStyle = (data: any, index: number) => { - if(typeof props.rowStyle === 'string') { + if (typeof props.rowStyle === "string") { return props.rowStyle; - } - return props.rowStyle(data, index); -} + } + return props.rowStyle(data, index); +}; const renderRowClassName = (data: any, index: number) => { - if(typeof props.rowClassName === 'string') { + if (typeof props.rowClassName === "string") { return props.rowClassName; - } - return props.rowClassName(data, index); -} + } + return props.rowClassName(data, index); +}; const childrenIndentSize = props.currentIndentSize + props.indentSize; @@ -140,11 +150,14 @@ const childrenIndentSize = props.currentIndentSize + props.indentSize;