Explorar el Código

禁止配置值输入换行符

zhangjie hace 2 años
padre
commit
6332cf2235
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      src/modules/admin/components/ValueModify.vue

+ 5 - 1
src/modules/admin/components/ValueModify.vue

@@ -35,7 +35,7 @@
       resize="none"
       :maxlength="999"
       :autosize="{ minRows: 1, maxRows: 6 }"
-      @input="valChange"
+      @input="textChange"
     ></el-input>
   </div>
 </template>
@@ -76,6 +76,10 @@ export default {
     valChange() {
       this.$emit("input", this.inputValue);
       this.$emit("change", this.inputValue);
+    },
+    textChange() {
+      this.inputValue = this.inputValue.replace(/\n/g, "");
+      this.valChange();
     }
   }
 };