forked from vue-generators/vue-form-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
51 lines (46 loc) · 985 Bytes
/
app.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
<template lang="html">
<div>
<vue-form-generator :schema="schema" :model="model" :options="formOptions"></vue-form-generator>
<pre><code>{{ model }}</code></pre>
</div>
</template>
<script>
import Vue from "vue";
import { validators } from "../../src";
export default {
data () {
return {
model: {
skills: ["Javascript", "VueJS"]
},
schema: {
fields: [
{
type: "checklist",
label: "Skills",
model: "skills",
required: true,
inputName:"skill",
min: 2,
listBox: true,
values: ["HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS"],
validator: validators.array,
onChanged(model) {
console.log("skills changed to", model.skills);
},
onValidated(model, errors) {
console.log("skills validated:", errors);
}
}
]
},
formOptions: {
validateAfterChanged: true
}
}
},
created() {
window.app = this;
}
}
</script>