-
Notifications
You must be signed in to change notification settings - Fork 533
/
Copy pathfieldCleave.vue
57 lines (51 loc) · 1.33 KB
/
fieldCleave.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<template lang="jade">
input.form-control(type="text", v-model="value", :autocomplete="schema.autocomplete", :disabled="disabled", :placeholder="schema.placeholder", :readonly="schema.readonly", :name="schema.inputName")
</template>
<script>
import abstractField from "./abstractField";
import { defaults } from "lodash";
export default {
mixins: [abstractField],
data() {
return {
cleave: null
};
},
ready() {
if (window.Cleave) {
this.cleave = new window.Cleave(this.$el, defaults(this.schema.cleaveOptions || {}, {
// Credit Card
creditCard: false,
// onCreditCardTypeChanged: onCreditCardTypeChanged.bind(this),
// Phone
phone: false,
phoneRegionCode: "AU",
// Date
date: false,
datePattern: ["d", "m", "Y"],
// Numerals
numeral: false,
numeralThousandsGroupStyle: "thousand",
numeralDecimalScale: 2,
numeralDecimalMark: ".",
// General
blocks: [],
delimiter: " ",
prefix: null,
numericOnly: false,
uppercase: false,
lowercase: false
}));
} else {
console.warn("Cleave is missing. Please download from https://github.com/nosir/cleave.js/ and load the script in the HTML head section!");
}
},
beforeDestroy() {
if (this.cleave)
this.cleave.destroy();
}
};
</script>
<style lang="sass">
.vue-form-generator .field-cleave {}
</style>