Commit 4ae39c53b49532fc6c31086a31e30429d2e236ed

Authored by 无木
1 parent fa64fc8a

fix(table): treeTable editable error

修复树表格的编辑问题

fixed: #811
src/components/Table/src/components/editable/EditableCell.vue
... ... @@ -44,6 +44,7 @@
44 44 import { propTypes } from '/@/utils/propTypes';
45 45 import { isString, isBoolean, isFunction, isNumber, isArray } from '/@/utils/is';
46 46 import { createPlaceholderMessage } from './helper';
  47 + import { set } from 'lodash-es';
47 48  
48 49 export default defineComponent({
49 50 name: 'EditableCell',
... ... @@ -227,14 +228,16 @@
227 228 if (!isPass) return false;
228 229 }
229 230  
230   - const { column, index } = props;
  231 + const { column, index, record } = props;
  232 + if (!record) return false;
231 233 const { key, dataIndex } = column;
232 234 const value = unref(currentValueRef);
233 235 if (!key || !dataIndex) return;
234 236  
235 237 const dataKey = (dataIndex || key) as string;
236 238  
237   - const record = await table.updateTableData(index, dataKey, value);
  239 + set(record, dataKey, value);
  240 + //const record = await table.updateTableData(index, dataKey, value);
238 241 needEmit && table.emit?.('edit-end', { record, index, key, value });
239 242 isEdit.value = false;
240 243 }
... ...