Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Fix in mask validation for first char #25

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions demo/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
</div>
</div>

<div class="row">
<div class="six columns">
<label for="credit-cart-ex">Phone number</label>
</div>
<div class="six columns">
<input class="u-full-width" id="credit-cart-ex" type="text" v-mask="'(###) ###-####'" placeholder="(999) 999-9999">
</div>
</div>

</section>

<section class="special-examples">
Expand Down
2 changes: 1 addition & 1 deletion src/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function (data, mask){
let c = data.charAt(i);
let m = mask.charAt(i);

if (data.length == 1 && i == 0 && i + 1 < mask.length && /^((?!(#|A|N|X)).)*/.test(m)) {
if (data.length == 1 && i == 0 && i + 1 < mask.length && ['#','A','N','X'].indexOf(m) === -1) {
text += m;
m = mask.charAt(i + 1);
}
Expand Down