use:
/**
* rebuild sheet
*/
resetForm(formName){
this.$refs[formName].resetFields();
},
report errors:
TypeError: Cannot read properties of undefined (reading 'resetFields')
at VueComponent.resetForm (index.vue?6ced:501)
at VueComponent.addColumn (index.vue?6ced:487)
at click (index.vue?5d22:653)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at VueComponent.invoker (vue.runtime.esm.js?2b0e:2179)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at VueComponent.Vue.$emit (vue.runtime.esm.js?2b0e:3888)
at VueComponent.handleClick (element-ui.common.js?5c96:9441)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at HTMLButtonElement.invoker (vue.runtime.esm.js?2b0e:2179)
Solution:
/**
* rebuild sheet
*/
resetForm(formName) {
//The purpose of adding if judgment condition is to solve the problem that the console prompt object does not exist
if (this.$refs[formName] !== undefined) {
this.$refs[formName].resetFields();
}
},