具有“应用”作为前缀,然后在输入字段中仅允许数字
我有一个需要输入字段的要求,必须具有前缀“应用程序”,然后允许用户输入仅7个数字值。我希望我可以使用NGX面具,但似乎不可能。另外,我正在考虑使用(焦点)事件,例如:
(focusin)="addPrefix($event)"
inputValue = "";
addPrefix(ev: any){
inputValue = "APP ";
}
然后有一个键盘事件,如果输入&lt< = 3。建议?谢谢
I have a requirement where I have an input field, that must have the prefix "APP " and then allow the user to type in 7 numeric only values. I was hoping I could use ngx-mask, but it doesn't seem possible. Alternatively I was thinking of using (focusin) event like:
(focusin)="addPrefix($event)"
inputValue = "";
addPrefix(ev: any){
inputValue = "APP ";
}
and then having a keyup event which would disregard key presses if input.length <= 3.But then comes this issue of pasting values in. Does anyone else have any better ideas/suggestions? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
”
使用NGX面具?
Stackblitz
How about,
using ngx-mask?