From 93af99292aa5050b52de1aa689f04d92292a27fe Mon Sep 17 00:00:00 2001 From: xiaoyucoding Date: Wed, 28 Nov 2018 17:47:52 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=BE=93=E5=85=A5=E9=9D=9E=E6=B3=95?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E6=97=B6=E4=B8=8D=E8=A7=A6=E5=8F=91=20input?= =?UTF-8?q?=20=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/components/input/index.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/view/components/input/index.vue b/src/core/view/components/input/index.vue index 7c0fe8b39..8166bb75a 100644 --- a/src/core/view/components/input/index.vue +++ b/src/core/view/components/input/index.vue @@ -197,6 +197,8 @@ export default { if (this.$refs.input.validity && !this.$refs.input.validity.valid) { $event.target.value = this.cachedValue this.inputValue = $event.target.value + // 输入非法字符不触发 input 事件 + return } else { this.cachedValue = this.inputValue } @@ -208,6 +210,8 @@ export default { if (maxlength > 0 && $event.target.value.length > maxlength) { $event.target.value = $event.target.value.slice(0, maxlength) this.inputValue = $event.target.value + // 字符长度超出范围不触发 input 事件 + return } } -- GitLab