Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要构建一个掩码,其中一些字符是固定的,例如用户必须指定最后三位数字的数字。
如何逃避“0”默认掩码行为?
文档说要使用反斜杠字符,但我不知道它应该如何工作。
示例:我的面具需要显示数字 12000___ 并且用户必须输入最后 3 位数字
html:
<kendo-maskedtextbox [mask]="mask"></kendo-maskedtextbox>
ts:
mask = "12\0\0\0000";
但它不编译...
反斜杠是(JavaScript)字符串中的转义字符,因此您需要转义反斜杠。
像这样:mask = "12\\0\\0\\0000"
mask = "12\\0\\0\\0000"
我还准备了一个Plunkr。