Open
Description
Note: for support questions, please use stackoverflow. This repository's issues are reserved for feature requests and bug reports.
- I'm submitting a ...
- [ x] bug report
- Do you want to request a feature or report a bug?
bug
- What is the current behavior?
v3 checklist does not work when using nested model
- If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
https://github.com/vesper8/vue-form-generator-v3-checklist-test
- What is the expected behavior?
v3 checklist should work when using nested model
- What is the motivation / use case for changing the behavior?
make checklist usable with nested models
-
Please tell us about your environment:
- Version: [3.0.0-beta.7]
- Browser: [Chrome 71]
- Language: [ES6/7 | ES5]
- Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
As mentioned by @AruXc in #515 (comment)
I'm using the latest beta (beta.7) of V3 and the checklist does not seem to support nested models.
This works:
<vue-form-generator :schema="test.schema" :model="test.model"></vue-form-generator>
test: {
model: {
test: [],
},
schema: {
fields: [
{
type: 'checklist',
model: 'test',
label: 'Test',
values: [
'apple', //
'orange',
'kiwi',
],
fieldOptions: {
listBox: true,
},
onChanged(model) {
console.log('skills changed to', model.test);
},
onValidated(model, errors) {
console.log('skills validated:', errors);
},
},
],
},
},
But this does not work:
test: {
model: {
test: {
test: [],
},
},
schema: {
fields: [
{
type: 'checklist',
model: 'test.test',
label: 'Test',
values: [
'apple', //
'orange',
'kiwi',
],
fieldOptions: {
listBox: true,
},
onChanged(model) {
console.log('skills changed to', model.test);
},
onValidated(model, errors) {
console.log('skills validated:', errors);
},
},
],
},
},
It gives the following error:
Uncaught TypeError: Cannot read property 'push' of undefined
at VueComponent.onChanged (vfg.umd.min.js?06f3:1)
at change (vfg.umd.min.js?06f3:1)
at invoker (vue.js?ba4c:2128)
at HTMLInputElement.fn._withTask.fn._withTask (vue.js?ba4c:1913)
@lionel-bijaoui mentioned this should be fixed in #532
But that was merged into beta.7 and that's what I'm using.. so not sure if it's something I'm doing or if it's still broken.. but it seems to not be working.. would appreciate some help! Thanks!