koumoul-dev / vuetify-jsonschema-form

Create beautiful and low-effort forms that output valid data. Published on npm as @koumoul/vjsf.
https://koumoul-dev.github.io/vuetify-jsonschema-form/latest/
MIT License
539 stars 154 forks source link

form context from api not rendered when sections are in schema #238

Open massimiliano-cannata opened 3 years ago

massimiliano-cannata commented 3 years ago

Hi all, quite new to vue... so maybe i'm missing something

I have a component:

data: { mymodel: {} }

mounted () : { const response = await axios.get('/user?ID=12345'); this.mymodel = response.json()[0] }

when i use a json schema without sections everything work well... I see the fetched data on my form...

but if I change the json schema and introduce sections using the "allOf": [ ] to split in tabs or expansion panel the loaded json is no more rendered...

Is it a bug? or should i force render somehow? any hints?

Maxi

albanm commented 3 years ago

There are some work in progress on the way reactivity works in this library. For now you should not consider that the model can be changed in both directions, it must be given at first then modifications bubble up only. In your case maybe a simple v-if="mymodel" on the v-sjf tag will work.

massimiliano-cannata commented 3 years ago

Thanks Alban, this workaround worked out perfectly, I combined v-if="isready" with created (): set model variable + set isready=true

;-)

Maxi

Il giorno mar 13 apr 2021 alle ore 14:38 Alban Mouton < @.***> ha scritto:

There are some work in progress on the way reactivity works in this library. For now you should not consider that the model can be changed in both directions, it must be given at first then modifications bubble up only. In your case maybe a simple v-if="mymodel" on the v-sjf tag will work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/koumoul-dev/vuetify-jsonschema-form/issues/238#issuecomment-818701900, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADC2FTGWMYFVBUUVOATYNKTTIQ3LBANCNFSM423GSRCQ .

-- Massimiliano Cannata

Professore SUPSI in ingegneria Geomatica

Responsabile settore Geomatica

Istituto scienze della Terra

Dipartimento ambiente costruzione e design

Scuola universitaria professionale della Svizzera italiana

Campus Mendrisio, Via Francesco Catenazzi 23

CH – 6850 Mendrisio

Tel. +41 (0)58 666 62 14

Fax +41 (0)58 666 62 09

@.***

www.supsi.ch/ist http://www.supsi.ch/ist