How to clean modal form after submit?
-
Hi there,
Scenario:
I have a register button, I click on it and it shows up a modal with a registration form. I submit my form and then modal is closed. If I click on register button again my form fields won’t be cleaned.Well, ok. I know modal is reusable. But how could I reset it at once after submit? Is there any easy way to do that?
-
clear the models…
-
-
well you should re-initialize your form modal models. ie.
const myForm = () => { return { name: '', password: '' } } ... data () { ... formData: myForm() ... methods: { ... onModalClose () { // call this function after modal close or successful submit etc.. // to re-init formdata this.formData = myForm() ....