forked from vue-generators/vue-form-generator
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfieldMasked.vue
31 lines (27 loc) · 861 Bytes
/
fieldMasked.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<template lang="pug">
input.form-control(type="text", v-model="value", :autocomplete="fieldOptions.autocomplete", :disabled="disabled", :placeholder="placeholder", :readonly="readonly", :name="inputName", :id="fieldID")
</template>
<script>
/* global $ */
import abstractField from "../abstractField";
export default {
name: "field-masked",
mixins: [abstractField],
mounted() {
this.$nextTick(function() {
if (window.$ && window.$.fn.mask) {
$(this.$el)
.unmask()
.mask(this.fieldOptions.mask, this.fieldOptions.maskOptions);
} else {
console.warn(
"JQuery MaskedInput library is missing. Please download from https://github.com/digitalBush/jquery.maskedinput and load the script in the HTML head section!"
);
}
});
},
beforeDestroy() {
if (window.$ && window.$.fn.mask) $(this.$el).unmask();
}
};
</script>