You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
简要
我希望利用defineModel实现一个手机号输入框,并且它具有输入校验功能(过滤非法字符)
简单来说,就是不希望用户能够输入规则以外的字符(比如字母/符号)又或者是总体文本长度.
尝试
我尝试了set方法,但是它return的值不会立即反馈到input本身(会有一个奇怪的延迟).
所以我不得不使用nextTick和一些判断,重新给input赋值
想法
所以我希望,defineModel的set能够解决这个问题,又或者能够增加一个类似filter/check字段来实现类似功能
代码
这是目前我想出的变相解决方案,仅供参考
Beta Was this translation helpful? Give feedback.
All reactions