From c0dd9c39583967a3763f61c2b2025f1dd09d9970 Mon Sep 17 00:00:00 2001 From: zhaojinfeng <121016171@qq.com> Date: Wed, 16 Aug 2023 11:54:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20multipleFormattter=E2=86=92formattt?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/select-table-modal/index.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/select-table-modal/index.vue b/packages/select-table-modal/index.vue index 4ec3983..9bd36e4 100644 --- a/packages/select-table-modal/index.vue +++ b/packages/select-table-modal/index.vue @@ -2,7 +2,7 @@ * @Author: zhaojinfeng 121016171@qq.com * @Date: 2023-07-18 12:30:07 * @LastEditors: zhaojinfeng 121016171@qq.com - * @LastEditTime: 2023-08-14 12:25:07 + * @LastEditTime: 2023-08-16 11:45:31 * @FilePath: \vue3\packages\select-table-modal\index.vue * @Description: 模态框选择表格 * @@ -115,7 +115,8 @@ const props = withDefaults( /** 是否多选 */ multiple?: boolean zIndex?: number - multipleFormattter?: (row: Record) => any + /** 单击确认按钮后的数据格式化函数 */ + formattter?: (row: Record) => any }>(), { hidePagination: false, @@ -128,7 +129,7 @@ const props = withDefaults( title: '选择', emptyText: '暂无数据', zIndex: 2023, - multipleFormattter(row: Record) { + formattter: (row: Record) => { return { ...row } }, }, @@ -185,7 +186,7 @@ const queryParams = reactive({ }) function initSelections() { - const rows = tableData.map(props.multipleFormattter) + const rows = tableData.map(props.formattter) tableRef?.toggleRowSelection(rows, true) } function initSelection() { @@ -218,7 +219,7 @@ async function getList() { /** 多选框选中数据 */ function handleSelectionChange(rows: any[]) { - selections = rows.map(props.multipleFormattter) + selections = rows.map(props.formattter) } function confirm() { if (props.multiple) {