瀏覽代碼

禁止配置值输入换行符

zhangjie 2 年之前
父節點
當前提交
6332cf2235
共有 1 個文件被更改,包括 5 次插入1 次删除
  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();
     }
   }
 };