Skip to content

Commit

Permalink
fix schema.fields error
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed May 25, 2017
1 parent b5d58ac commit d2b67e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 12 additions & 2 deletions dev/multipleforms/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<form>
<vue-form-generator :schema="section1" :model="model" :options="formOptions"></vue-form-generator>
<vue-form-generator :schema="section2" :model="model" :options="formOptions"></vue-form-generator>
<pre>{{ model }}</pre>
</form>
</template>

Expand All @@ -14,6 +15,8 @@ export default {
model: {
name: 'Brian Blessed',
email: "brian@hawkman.mongo",
more: "More",
things: "Things",
pref_1: 'blah'
},
Expand Down Expand Up @@ -50,8 +53,15 @@ export default {
model: "things"
}
]
}]
}],
fields: [
{
type: "input",
inputType: "text",
label: "Pref 1 (without group)",
model: "pref_1"
}
]
},
section2: {
Expand Down
6 changes: 4 additions & 2 deletions src/formGenerator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ div.vue-form-generator(v-if='schema != null')
beforeMount() {
// Add idPrefix to fields if fieldIdPrefix is set
for (let field of this.schema.fields) {
field.idPrefix = this.options.fieldIdPrefix || "";
if (this.schema.fields) {
for (let field of this.schema.fields) {
field.idPrefix = this.options.fieldIdPrefix || "";
}
}
},
Expand Down

0 comments on commit d2b67e0

Please sign in to comment.