fix(table): ensure that editable cell values are echoed correctly close #335

This commit is contained in:
Vben
2021-03-11 22:01:08 +08:00
parent e15737b9d1
commit fab7a6c58d
2 changed files with 6 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ const demoList = (() => {
export default [ export default [
{ {
url: '/basic-api/select/getDemoOptions', url: '/basic-api/select/getDemoOptions',
timeout: 4000, timeout: 2000,
method: 'get', method: 'get',
response: ({ query }) => { response: ({ query }) => {
console.log(query); console.log(query);

View File

@@ -13,7 +13,6 @@
:popoverVisible="getRuleVisible" :popoverVisible="getRuleVisible"
:rule="getRule" :rule="getRule"
:ruleMessage="ruleMessage" :ruleMessage="ruleMessage"
allowClear
size="small" size="small"
ref="elRef" ref="elRef"
@change="handleChange" @change="handleChange"
@@ -183,14 +182,16 @@
async function handleChange(e: any) { async function handleChange(e: any) {
const component = unref(getComponent); const component = unref(getComponent);
if (e?.target && Reflect.has(e.target, 'value')) { if (!e) {
currentValueRef.value = e;
} else if (e?.target && Reflect.has(e.target, 'value')) {
currentValueRef.value = (e as ChangeEvent).target.value; currentValueRef.value = (e as ChangeEvent).target.value;
} } else if (component === 'Checkbox') {
if (component === 'Checkbox') {
currentValueRef.value = (e as ChangeEvent).target.checked; currentValueRef.value = (e as ChangeEvent).target.checked;
} else if (isString(e) || isBoolean(e) || isNumber(e)) { } else if (isString(e) || isBoolean(e) || isNumber(e)) {
currentValueRef.value = e; currentValueRef.value = e;
} }
table.emit?.('edit-change', { table.emit?.('edit-change', {
column: props.column, column: props.column,
value: unref(currentValueRef), value: unref(currentValueRef),