瀏覽代碼

提交的时候去除input框的前后空格

lxf 2 年之前
父節點
當前提交
a6caf70840
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/components/byForm/index.vue

+ 4 - 1
src/components/byForm/index.vue

@@ -28,7 +28,7 @@
       >
       >
         <el-input
         <el-input
           v-if="i.type == 'input'"
           v-if="i.type == 'input'"
-          v-model.trim="formData[i.prop]"
+          v-model="formData[i.prop]"
           :placeholder="i.placeholder || '请输入'"
           :placeholder="i.placeholder || '请输入'"
           @input="(e) => commonsEmit(e, i)"
           @input="(e) => commonsEmit(e, i)"
           :type="i.itemType ? i.itemType : 'text'"
           :type="i.itemType ? i.itemType : 'text'"
@@ -470,6 +470,9 @@ const handleSubmit = async (onSubmit) => {
         if (item.type == "json") {
         if (item.type == "json") {
           form[item.prop] = JSON.stringify(form[item.prop]);
           form[item.prop] = JSON.stringify(form[item.prop]);
         }
         }
+        if (item.type == 'input') {
+          form[item.prop] = form[item.prop].trim();
+        }
       });
       });
       emit("update:modelValue", form);
       emit("update:modelValue", form);
       onSubmit();
       onSubmit();