前言

  当我们使用element ui的el-select组件时,是无法使用:maxlength和type='number'来改变增加远程搜索功能的el-select,此时我们可以给该组件增加 @input.native="func" 来强定义到子组件的input,获取监听它的方法,并加上正则就可以限制为我们需要的数据。

e.target.value = e.target.value.replace(/^(0+)|[^\d]+/g, '').replace(/\d{8,}/, (match) => match.slice(0, 8))

  

posted on 2024-06-28 11:18  Tom最好的朋友是Jerry  阅读(1)  评论(0编辑  收藏  举报