vue 中使用input number类型 maxlength失效

vue中使用el-input不好用,想只能输入数字,且最大长度10 ,但是maxlength属性不管用

于是

template

 
script
 data : userId

 methods:
    changeNum: function(e) {
      //限制长度
      if(this.userId.length>10){
        this.userId=this.userId.slice(0,10)
      }
    },

style
 //隐藏箭头
 input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
input[type="number"] {
  -moz-appearance: textfield;
}

 

你可能感兴趣的:(vue,报错,input)