[bugfix] Field: cut off charactor input when use maxlength (#2295)

This commit is contained in:
neverland 2018-12-15 16:53:06 +08:00 committed by GitHub
parent ebef4d3d3d
commit f60541c396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,7 +146,7 @@ export default create({
let { value } = target;
const { maxlength } = this.$attrs;
if (this.isDef(maxlength) && value.length > maxlength) {
if (this.type === 'number' && this.isDef(maxlength) && value.length > maxlength) {
value = value.slice(0, maxlength);
target.value = value;
}