You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having a problem with something that's actually quite simple. I have a compose which allows to create or modify an element by opening a modal to display the form.
So I have a props which is not mandatory with a default value (a class instance). I initialize a variable in the setup and I give the default value. After modification, I save and therefore via an emit I send the element. But the problem is that when I open the modal again the fields stay filled with the data from the last item to send. Worse, the element that the parent to retrieve is changed if I modify in the modal.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'm having a problem with something that's actually quite simple. I have a compose which allows to create or modify an element by opening a modal to display the form.
So I have a props which is not mandatory with a default value (a class instance). I initialize a variable in the setup and I give the default value. After modification, I save and therefore via an emit I send the element. But the problem is that when I open the modal again the fields stay filled with the data from the last item to send. Worse, the element that the parent to retrieve is changed if I modify in the modal.
I wanted to use the code:
Object.assign(Object.create(Object.getPrototypeOf(myClass)), myClass)
To initialize the variable in the setup script and the same in the computed when the viable to close the modal is false I redo a
myVar = reactive(Object.assign(Object.create(Object.getPrototypeOf(props.initMyVar)), props.initMyVar))
I also did this for the emit.
But when I reopen the parent element is no longer modified, but nothing reacts properly.
Do you have an idea ?
I note that I am trying to reset with a js class instance not an object.
Thanks a lot for your help
Beta Was this translation helpful? Give feedback.
All reactions