I need some help on some Vue (version 2) basic logic concept about communicating between components, I can't seem to grasp..
I have a dashboard (Dashboard.vue) from which I open a popup:
<FormXPopup v-show="isVisible">
Inside FormXPopup.vue I have a popup component <Popup> with a content slot.
Popup has a close button that emits 'close' which toggles the isVisible boolean in Dashboard.vue.
In Popup's content slot I've placed a form component: <FormX>
FormX has form validation. And a cancel button which also emits 'close' in Dashboard.vue.
Now I want to clear all validation when closing the popup.
I can easily clear it and then emit 'close' when I click the cancel button from inside FormX.vue.
However when I click the close button which resides in <Popup> I don't know how to clear the form.
Also, Popup is being reused so I'm looking for a flexible solution.
So how do I clear the form (the child) when I close the popup (the parent)?