// 需求:输入座机号只允许输入数字和"-"
onChange(e){
this.$nextTick(()=>{
this.phone = e.target.value.replace(/[^0-9-]/g, '');
})
}
解决:添加**this.$nextTick**即可
Vue iview输入框change事件replace正则替换不生效问题的解决。
最新推荐文章于 2024-07-06 16:47:02 发布
// 需求:输入座机号只允许输入数字和"-"
onChange(e){
this.$nextTick(()=>{
this.phone = e.target.value.replace(/[^0-9-]/g, '');
})
}
解决:添加**this.$nextTick**即可