3
0
Quellcode durchsuchen

禁止配置值输入换行符

zhangjie vor 2 Jahren
Ursprung
Commit
6332cf2235
1 geänderte Dateien mit 5 neuen und 1 gelöschten Zeilen
  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();
     }
   }
 };