Преглед на файлове

fix(table): fix the table in the editable row status and press Enter to confirm #258

vben преди 4 години
родител
ревизия
64533f6204
променени са 2 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 1 0
      CHANGELOG.zh_CN.md
  2. 9 1
      src/components/Table/src/components/editable/EditableCell.vue

+ 1 - 0
CHANGELOG.zh_CN.md

@@ -11,6 +11,7 @@
 - 修复代码 debugger 位置显示错误
 - 修复 mock 插件 post 请求错误问题
 - 修复部分主题颜色值错误
+- 修复表格在可编辑行状态回车确认
 
 ### 🎫 Chores
 

+ 9 - 1
src/components/Table/src/components/editable/EditableCell.vue

@@ -17,7 +17,7 @@
         ref="elRef"
         @change="handleChange"
         @options-change="handleOptionsChange"
-        @pressEnter="handleSubmit"
+        @pressEnter="handleEnter"
       />
       <div :class="`${prefixCls}__action`" v-if="!getRowEditable">
         <CheckOutlined :class="[`${prefixCls}__icon`, 'mx-2']" @click="handleSubmit" />
@@ -234,6 +234,13 @@
         isEdit.value = false;
       }
 
+      async function handleEnter() {
+        if (props.column?.editRow) {
+          return;
+        }
+        handleSubmit();
+      }
+
       function handleCancel() {
         isEdit.value = false;
         currentValueRef.value = defaultValueRef.value;
@@ -311,6 +318,7 @@
         getWrapperStyle,
         getRowEditable,
         getValues,
+        handleEnter,
         // getSize,
       };
     },