I'm currently facing an issue on a Vue page that utilizes the Vuetify framework. The problem arises with a button that triggers a dialog from a child component:
<div id="app">
<v-app id="inspire">
<v-row justify="center" class="d-flex align-center">
<my-dialog v-model="dialog"></my-dialog>
<v-btn color="primary" dark @click="openDialog">Open Dialog</v-btn>
</v-row>
</v-app>
</div>
My goal is to reset the form inside the dialog when it opens by using the this.$refs.form.reset()
function as recommended in the Vuetify documentation. However, I encounter an error the first time I attempt to open the dialog:
"[Vue warn]: Error in v-on handler: 'TypeError: Cannot read property 'reset' of undefined'
. Subsequent attempts do not generate any errors, suggesting that the "form reference" cannot be found initially. Can someone kindly assist me in properly resetting the form when the dialog opens?
To simplify the demonstration, I have created a CodePen with just one component: https://codepen.io/dadax91981/pen/VweqeJX?editors=1010
Thank you.