Parcourir la source

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

lxf il y a 2 ans
Parent
commit
a6caf70840
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      src/components/byForm/index.vue

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

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