Skip to content

Commit

Permalink
fix(table): editComponentProps support onChange
Browse files Browse the repository at this point in the history
修复editComponentProps不支持onChange的问题
  • Loading branch information
mynetfan committed Jun 28, 2021
1 parent 3dbbde2 commit 829b366
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Table/src/components/editable/EditableCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import { propTypes } from '/@/utils/propTypes';
import { isString, isBoolean, isFunction, isNumber, isArray } from '/@/utils/is';
import { createPlaceholderMessage } from './helper';
import { set } from 'lodash-es';
import { set, omit } from 'lodash-es';
export default defineComponent({
name: 'EditableCell',
Expand Down Expand Up @@ -108,7 +108,7 @@
return {
placeholder: createPlaceholderMessage(unref(getComponent)),
...apiSelectProps,
...compProps,
...omit(compProps, 'onChange'),

This comment has been minimized.

Copy link
@CyrusZhou-CN

CyrusZhou-CN Jun 27, 2022

是不是搞反了?

...omit(compProps, 'onChange'),

这应该是忽略 onChange ,会导致 editComponentProps onChange 被取消,如下功能将不支持:

editComponentProps: ({ record }) => {
      return {
        options: effectTypeData,
        onChange: () => {
        },
      };
    },
[valueField]: value,
};
});
Expand Down Expand Up @@ -184,6 +184,8 @@
} else if (isString(e) || isBoolean(e) || isNumber(e)) {
currentValueRef.value = e;
}
const onChange = props.column?.editComponentProps?.onChange;
if (onChange && isFunction(onChange)) onChange(...arguments);
table.emit?.('edit-change', {
column: props.column,
Expand Down

0 comments on commit 829b366

Please sign in to comment.