提交 4ae39c53 编写于 作者: 无木

fix(table): treeTable editable error

修复树表格的编辑问题

fixed: #811
上级 fa64fc8a
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
import { propTypes } from '/@/utils/propTypes'; import { propTypes } from '/@/utils/propTypes';
import { isString, isBoolean, isFunction, isNumber, isArray } from '/@/utils/is'; import { isString, isBoolean, isFunction, isNumber, isArray } from '/@/utils/is';
import { createPlaceholderMessage } from './helper'; import { createPlaceholderMessage } from './helper';
import { set } from 'lodash-es';
export default defineComponent({ export default defineComponent({
name: 'EditableCell', name: 'EditableCell',
...@@ -227,14 +228,16 @@ ...@@ -227,14 +228,16 @@
if (!isPass) return false; if (!isPass) return false;
} }
const { column, index } = props; const { column, index, record } = props;
if (!record) return false;
const { key, dataIndex } = column; const { key, dataIndex } = column;
const value = unref(currentValueRef); const value = unref(currentValueRef);
if (!key || !dataIndex) return; if (!key || !dataIndex) return;
const dataKey = (dataIndex || key) as string; const dataKey = (dataIndex || key) as string;
const record = await table.updateTableData(index, dataKey, value); set(record, dataKey, value);
//const record = await table.updateTableData(index, dataKey, value);
needEmit && table.emit?.('edit-end', { record, index, key, value }); needEmit && table.emit?.('edit-end', { record, index, key, value });
isEdit.value = false; isEdit.value = false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册