fix(EditableCell): 修复可编辑表格 组件onChange重复问题 (#2495)

* fix: props 初始化拼写错误 defualt => default

* fix: props 定义默认值拼写错误 defualt => default

* fix(EditableCell): 修复可编辑表格select组件onChange重复问题

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
This commit is contained in:
Wit〆苗大 2023-01-18 11:16:33 +08:00 committed by GitHub
parent 7e77177ed8
commit 0cc53558fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -77,6 +77,11 @@
if (isFunction(compProps)) {
compProps = compProps({ text: val, record, column, index }) ?? {};
}
// onChange handleChange onChange, onChange
compProps.onChangeTemp = compProps.onChange;
delete compProps.onChange;
const component = unref(getComponent);
const apiSelectProps: Recordable = {};
if (component === 'ApiSelect') {
@ -187,7 +192,7 @@
} else if (isString(e) || isBoolean(e) || isNumber(e) || isArray(e)) {
currentValueRef.value = e;
}
const onChange = unref(getComponentProps)?.onChange;
const onChange = unref(getComponentProps)?.onChangeTemp;
if (onChange && isFunction(onChange)) onChange(...arguments);
table.emit?.('edit-change', {
@ -404,8 +409,7 @@
column: this.column,
index: this.index,
})
: (this.getValues ?? "\u00A0")
}
: this.getValues ?? '\u00A0'}
</div>
{!this.column.editRow && <FormOutlined class={`${this.prefixCls}__normal-icon`} />}
</div>