Browse Source
fix(EditableCell): 修复可编辑表格 组件onChange重复问题 (#2495)
* fix: props 初始化拼写错误 defualt => default
* fix: props 定义默认值拼写错误 defualt => default
* fix(EditableCell): 修复可编辑表格select组件onChange重复问题
Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
pull/2504/head
Wit〆苗大
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
3 deletions
-
src/components/Table/src/components/editable/EditableCell.vue
|
|
|
@ -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> |
|
|
|
|