el-input限制输入

<el-input type="text" @input.native="changeCode" v-model="formSearch.licensedCode" maxlength="40" placeholder="请输入" clearable></el-input>

<script>
methods:{
changeCode() {
  this.$nextTick(() => {
    if(this.formSearch.licensedCode !== null){
      this.formSearch.licensedCode = this.formSearch.licensedCode.replace(/[^\d]/g,'')
    }
  })
},
}
</script>

 

上一篇:4、node中的宏任务和微任务(大活和小活)


下一篇:VUE:nextTick、$refs、嵌套路由、keep-alive缓存、is特性、路由属性用法、路由钩子函数