refactor: multipleFormattter→formattter
This commit is contained in:
@ -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<string, any>) => any
|
||||
/** 单击确认按钮后的数据格式化函数 */
|
||||
formattter?: (row: Record<string, any>) => any
|
||||
}>(),
|
||||
{
|
||||
hidePagination: false,
|
||||
@ -128,7 +129,7 @@ const props = withDefaults(
|
||||
title: '选择',
|
||||
emptyText: '暂无数据',
|
||||
zIndex: 2023,
|
||||
multipleFormattter(row: Record<string, any>) {
|
||||
formattter: (row: Record<string, any>) => {
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user