Skip to content

Commit d2b67e0

Browse files
committed
fix schema.fields error
1 parent b5d58ac commit d2b67e0

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

dev/multipleforms/app.vue

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<form>
33
<vue-form-generator :schema="section1" :model="model" :options="formOptions"></vue-form-generator>
44
<vue-form-generator :schema="section2" :model="model" :options="formOptions"></vue-form-generator>
5+
<pre>{{ model }}</pre>
56
</form>
67
</template>
78

@@ -14,6 +15,8 @@ export default {
1415
model: {
1516
name: 'Brian Blessed',
1617
18+
more: "More",
19+
things: "Things",
1720
pref_1: 'blah'
1821
},
1922
@@ -50,8 +53,15 @@ export default {
5053
model: "things"
5154
}
5255
]
53-
}]
54-
56+
}],
57+
fields: [
58+
{
59+
type: "input",
60+
inputType: "text",
61+
label: "Pref 1 (without group)",
62+
model: "pref_1"
63+
}
64+
]
5565
},
5666
5767
section2: {

src/formGenerator.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ div.vue-form-generator(v-if='schema != null')
151151
152152
beforeMount() {
153153
// Add idPrefix to fields if fieldIdPrefix is set
154-
for (let field of this.schema.fields) {
155-
field.idPrefix = this.options.fieldIdPrefix || "";
154+
if (this.schema.fields) {
155+
for (let field of this.schema.fields) {
156+
field.idPrefix = this.options.fieldIdPrefix || "";
157+
}
156158
}
157159
},
158160

0 commit comments

Comments
 (0)