Browse Source

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

pull/768/head
cKey 3 years ago
parent
commit
204486ea1e
  1. 10
      apps/vue/src/components/Table/src/components/editable/EditableCell.vue

10
apps/vue/src/components/Table/src/components/editable/EditableCell.vue

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

Loading…
Cancel
Save