diff --git a/src/core/view/components/input/index.vue b/src/core/view/components/input/index.vue index 7c0fe8b394123a7d3d2f0737ec9e818e320ec337..8166bb75a89ff5703767ba7a3bd9a04937dd8887 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 } }