Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added 'visible' support to model #5

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
74 changes: 71 additions & 3 deletions example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
</v-tabs-bar>
<v-tabs-items class="ma-5">
<v-tabs-content :id="'form'">
<v-form-generator :model="model" :schema="schema" :options="options"/>
<v-form-generator
:model="model"
:schema="schema"
:options="options"
@blur="onBlur"
@change="onChange"
@focus="onFocus"
@input="onInput"/>
</v-tabs-content>
<v-tabs-content :id="'model'">
<pre>{{model}}</pre>
Expand Down Expand Up @@ -42,15 +49,26 @@
skills: ["Javascript", "VueJS"],
email: "[email protected]",
status: true,
usePassword: true
usePassword: true,
showHiddenField: true,
skillsRadio: null,
switch: false
},
schema: {
fields: [{
type: "number",
label: "ID (disabled text field)",
model: "id",
readonly: true,
disabled: true
disabled: true,
visible: true
},{
type: "number",
label: "Hidden Field",
model: "idHidden",
readonly: true,
disabled: true,
visible: false
},{
type: "text",
label: "Name",
Expand Down Expand Up @@ -78,6 +96,30 @@
model: "skills",
values: ["Javascript", "VueJS", "CSS3", "HTML5"]
},{
type: "radio",
label: "Select a skill",
model: "skillsRadio",
values: [
{
"label": "Javascripts",
"value": "1"
},
{
"label": "VueJS",
"value": "2"
},
{
"label": "CSS3",
"value": "3"
}
]
},
{
type: "switch",
label: "Switch ON/OFF",
model: "switch"
},
{
type: "email",
label: "E-mail",
model: "email",
Expand All @@ -87,6 +129,16 @@
label: "Status",
model: "status",
default: true
},{
type: "checkbox",
label: "Show next field?",
model: "showHiddenField"
},{
type: "text",
label: "Hidden Field",
model: "conditionlHiddenField",
placeholder: "Some text",
visible: (model, field) => model.showHiddenField === true,
}],
groups: [
{
Expand Down Expand Up @@ -135,5 +187,21 @@
}
}
},
methods: {
onBlur: function(){
console.info('blur')
},
onChange: function(evt){
console.info('change')
this.model[evt.model] = evt.value
},
onFocus: function(){
console.info('focus')
},
onInput: function(evt){
console.info('input')
this.model[evt.model] = evt.value
}
}
}
</script>
Loading