Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4e7d5ba

Browse files
committed
Add input mask field
1 parent 16581fb commit 4e7d5ba

File tree

7 files changed

+42
-1
lines changed

7 files changed

+42
-1
lines changed

‎dev/data.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ module.exports = {
2626
user.bio = faker.lorem.paragraph();
2727
let dob = faker.date.past(40, "1998年01月01日");
2828
user.dob = dob.valueOf();
29+
user.time = moment().format("hh:mm:ss");
2930
user.age = moment().year() - moment(dob).year();
3031
user.rank = faker.random.number({
3132
min: 1,
3233
max: 10
3334
});
3435
user.role = faker.helpers.randomize(roles).id;
35-
36+
//user.mobile = faker.phone.phoneNumber();
3637

3738
user.skills = [];
3839
user.skills.push(faker.helpers.randomize(skills));

‎dev/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/7.0.2/bootstrap-slider.min.js"></script>
1919
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
2020
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.js"></script>
21+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.js"></script>
2122
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.3.0/lodash.min.js"></script>
2223
</head>
2324
<body>

‎dev/schema.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ module.exports = {
113113
help: "You can use any <b>formatted</b> texts. Or place a <a target='_blank' href='https://github.com/icebob/vue-form-generator'>link</a> to another site."
114114
//validator: validators.regexp
115115
},
116+
{
117+
type: "masked",
118+
label: "Mobile",
119+
model: "mobile",
120+
mask: "(99) 999-9999"
121+
},
116122
{
117123
type: "spectrum",
118124
label: "Color",

‎src/fields/fieldDateTime.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
ready() {
4848
if ($.fn.datetimepicker)
4949
$(this.$el).datetimepicker(this.schema.dateTimePickerOptions);
50+
else
51+
console.warn("Bootstrap datetimepicker library is missing. Please download from https://eonasdan.github.io/bootstrap-datetimepicker/ and load the script and CSS in the HTML head section!");
52+
5053
}
5154
}
5255
</script>

‎src/fields/fieldMasked.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template lang="jade">
2+
input.form-control(type="text", v-model="value", :readonly="schema.readonly", :disabled="disabled", :placeholder="schema.placeholder")
3+
</template>
4+
5+
<script>
6+
import abstractField from './abstractField';
7+
8+
export default {
9+
mixins: [ abstractField ],
10+
11+
ready() {
12+
if ($.fn.mask)
13+
$(this.$el).mask("destroy").mask(this.schema.mask, this.schema.maskOptions);
14+
else
15+
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!");
16+
}
17+
}
18+
</script>
19+
20+
<style lang="sass" scoped>
21+
input {
22+
width: 100%;
23+
}
24+
</style>

‎src/fields/fieldSelectEx.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
ready() {
4747
if ($.fn.selectpicker)
4848
$(this.$el).selectpicker("destroy").selectpicker(this.schema.selectOptions);
49+
else
50+
console.warn("Bootstrap-select library is missing. Please download from https://silviomoreto.github.io/bootstrap-select/ and load the script and CSS in the HTML head section!");
51+
4952
}
5053
}
5154
</script>

‎src/fields/fieldSpectrum.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
3030
}
3131
}));
32+
else
33+
console.warn("Spectrum color library is missing. Please download from http://bgrins.github.io/spectrum/ and load the script and CSS in the HTML head section!");
3234
}
35+
3336
}
3437
</script>
3538

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /