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

Multi level model on Vue CLI 3 template not working #523

Closed
AlejandroMut opened this issue Oct 16, 2018 · 9 comments
Closed

Multi level model on Vue CLI 3 template not working #523

AlejandroMut opened this issue Oct 16, 2018 · 9 comments

Comments

@AlejandroMut
Copy link

Hi,

I am updating my app to the new Vue CLI 3 and noticed that all my fields using a multi-level model stopped working (the field's value remains undefined).

model: {
    id: 1234,
    person: {
        name: "John Doe"
        age: 22
    },
}

For example, a field using id will work fine, but person.name or person.age won't.

I tested vue-form-generator on a brand new project created with Vue CLI 3 (default settings) and the problem persists.

Any ideas?

Thanks!

@AlejandroMut
Copy link
Author

Actually, the Vue CLI version has nothing to do. It seems to be a bug in vue-form-generator version 2.3.1.

I rolled back to version 2.3.0 and it works fine.

@AruXc
Copy link

AruXc commented Oct 17, 2018

It also my problem . I use get(model) set(model, value) to fix it, but still have some bug here, and code will be dirty. So hope it will update for this problem.

@AruXc
Copy link

AruXc commented Oct 17, 2018

can you use groups for multi-level schema? I can only two layers

@LouWii
Copy link

LouWii commented Oct 17, 2018

I'm having the same problem here and I'm not using Vue CLI 3. Running Vue v2.5.17

@AruXc can you give an example of how you do it with get(model) and set(model, value) ?

@lionel-bijaoui
Copy link
Member

Will be fixed soon, same problem as #526
Will do a PR tomorrow !

@LouWii
Copy link

LouWii commented Oct 17, 2018

@lionel-bijaoui I just realized it! Thanks for the quick response. I rolled back to 2.3.0 in the meantime.

@AruXc
Copy link

AruXc commented Oct 18, 2018

@LouWii simple example but I think this is not a good way to write.


      model: {
        smoking: {
          smoking: true
        }
      },
      schema: {
        fields: [
          {
            type: "radios",
            model: "",
            values: [
              { name: "No", value: false },
              { name: "Yes", value: true }
            ],
            get(model) {
              return model.smoking.smoking
            },
            set(model, value) {
              model.smoking.smoking = value
            }
          }
        ]
      }

@LouWii
Copy link

LouWii commented Oct 18, 2018

@AruXc That's an interesting way of doing it. I installed v2.3.0 and I don't have issues anymore, no need for a work around. You can probably try that if you like.

@lionel-bijaoui
Copy link
Member

Should be fixed by #532

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants