When you click the empty form button, an error will be reported because the form contains values that are not found;
For example, when active = 1, the prop of El form item is bound to username; When active = 2, prop binds gender;
When active = 1, the form contains username and gender, and gender is not displayed on the page. When the form is cleared, all values in the form will be cleared, and the gender field cannot be found, so an error is reported;
Solution:
Replace the resetfields provided with element with each item in the form as the initial value;
For example:
reset(formName){
this.form.username='',
this.form.gender=''
this.$nextTick(() => {
this.$refs[formName].clearValidate(); //To clear the checksum prompt
});
}
Read More:
- [Vue warn]: Error in render: TypeError: Cannot read property ‘xxxx’of undefined
- Vue error in render: “typeerror: cannot read property ‘length’ of undefined”
- Wechat program typeerror: a solution to cannot read property ‘SetData’ of undefined
- [Solved] Vue + uniapp Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- [Solved] Vue Error: Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- [Solved] VUE Use Filters Error: [Vue warn]: Error in render: “TypeError: Cannot read property ‘toFixed’ of undefined”
- Uniapp: TypeError: Cannot read property ‘apply‘ of undefined (H5 does not report an error, but the real machine runs with an error)
- [Solved] Cannot read properties of undefined (reading ‘ajax‘); Cannot read property ‘ajax‘ of undefined
- Can’t read property ‘push’ of undefined [How to Solve]
- Vue ElementUI el-dropdown Error: Uncaught TypeError: Cannot read property ‘disabled‘ of null
- [Solved] vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: “TypeError: Cannot read property ‘length‘
- [Solved] Echarts Error: Cannot read property ‘init‘ of undefined
- [Solved] Parcel Package Error: Cannot read property ‘length‘ of undefined
- VUE Echarts Loading Error TypeError: Cannot read property getAttribute of null?
- Vue Error in callback for immediate watcher “height”: “TypeError: Cannot read property ‘style’ of
- cesium CLAMP_TO_GROUND Error Cannot read property ‘globe‘ of undefined
- El-cascader error: Cannot read property’level’ of null
- [Solved] uview u-sticky Error: Cannot read property ‘bottom‘ of null
- openlayers — Cannot read property ‘slice‘ of null—Map cannot be loaded