[Solved] Element-ui dialog box reset form error: Cannot read property’resetFields’ of undefined

problem causes:

After mouted loads the table data, the hidden pop-up box is not compiled and rendered into the dom. When the click pops up, $refs does not get the dom element, resulting in’resetFields’ of undefined.


If it is the first time you click to add, there is no need to reset, according to the element undefined judgment


resetForm() {
       if ( this .$refs.userEditRef !== undefined) {
         this .$refs.userEditRef.resetFields()

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *