zhangdaiscott 发表于 2021-3-15 18:16:41

Element-UI Form表单 resetFields() 重置表单无效问题

描述:最近在使用Element-UI 的 Form 组件时,遇到了给清空按钮设置了resetFields(),点击却无法生效的问题

解决:表单项 el-form-item 的 prop 属性值应该与表单项内部控件的 v-model 保持一致
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAiAAAABKCAYAAACCee8JAAAWOElEQVR4Ae1dO28bOxP1X0idLpUKAwEClalSuEgVpLlfkdoBjPS3iQvXAdylcBU3qdL5D6S6v4sfhuSQh899SFpppVMY0u6Sw3mc5RwOV96rzfXW8I8+IAaIAWKAGCAGiIElMXC15GAci+AmBogBYoAYIAaIAcEACQgrQKyAEQPEADFADBADi2OABISgWxx0XP1w9UMMEAPEADFAAkICQgJCDBADxAAxQAwsjgESEIJucdBx5cOVDzFADBADxMAqCch///3HpEniRAwQA8QAMUAMrBgDJCArDh5XEFxBEAPEADFADKwVAyQgJCBcQRADxAAxQAwQA4tjgASEoFscdGtl65eq9+3T1c4Y2YeMS/U/7WaF41wxQAJCArJzcjnXm4N2bY0Qh95f7qMe0ehdy+XwmEmXGDh/DJCAnBkB+fjwYv68/HV/P/+dSS7+Z+5/exkia7acfd9A/5pH0ef3o/l4MnHzOlmfv5j7T1Nslr5T+4D8T4/ml8b65dl8neSTt+bmx5W5/b4xm+uN+fx0Zb7cvU3wosSjlgh6ZKJ3rSbLnQMdPrwxX56uzOd/wNZJtp1Sv3Xa9e7ulbn98ca8m+l32//ptXl/vTXvv1/tJKuNmVOKM3WZE6ejEpCvP12Se/w2LXj8FcywvywRmUkcbN+TSvJqb4eA2GQ8NQmr3H18ziETc/pUdJ1le5+AIInA7zLJ5Me1iUfbyGfrL+23zkSd2lCJDZK7FRErEpBaLHluGO/TfHQcAvLt2a7QHx/cCo4EpBM0O2m5lcSU4O9CQIQY/nr4X7IanjL2UdrOSsIdv09e+c0hE3P6VHSeabusTF3Vw5GRXsUBScTc+CopqfdHHYSMvDI3Hyq2To7LsWWs065dCc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s5ERIDxAAxQAwshQESEBKQ7lPKSwGR43DSIwaIAWLgsjBAAkICQgJCDBADxAAxQAwsjgESEIJucdBxlXNZqxzGm/EmBoiBGgZIQEhASECIAWKAGCAGiIHFMbBKAlJjUjxHhk0MEAPEADFADKwHAyQgZL2Ls15OEOuZIBgrxooYIAYOhYH/A6COtU+XTrQQAAAAAElFTkSuQmCC

总结:
重置无效的几种情况: 首先是官网的相关介绍:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtgAAACKCAYAAACQCj3QAAAgAElEQVR4Ae2dz47cNrPF84b9MLHnQRwPjHmEC+SDYcCzuou7SwDDgGHg4i4COEiysldZBIGXuiiSRVZRlCj1qGek6V8Ap/WHLBYPDw+P2HL7h4H/QAAEQAAEQAAEQAAEQAAENkPgh80iEQgEQAAEQAAEQAAEQAAEQGDAYEMCEAABEAABEAABEAABENgQAQz2hmASCgRAAARAAARAAARAAAQw2HAABEAABEAABEAABEAABDZEAIO9IZiEAgEQAAEQAAEQAAEQAAEMNhwAARAAARAAARAAARAAgQ0RwGBvCCahQAAEQAAEQAAEQAAEQACDDQdAAARAAARAAARAAARAYEMEMNgbgkkoEAABEAABEAABEAABEMBgwwEQAAEQAAEQAAEQAAEQ2BABDPaGYBIKBEAABEAABEAABEAABBYZ7C9fvgz8AQM4AAfgAByAA3AADsABOBA5MPcYsdhg//3PvwN/wOBSHJDJeqnYxIW3cAAOwAE4AAfgwJYcEN8y9x8GmweHXRhbDDbCt6XwEQs+wQE4AAfgwCU5gMHGQO/CQPdIjsFGCHsc4T4cgQNwAA7Agb1wAIONwcZgw4FDcGAvokkeLOBwAA7AATjQ4wAGG3N1CHPFDjZi1hMz7sMROAAH4AAc2AsHMNgYbAw2HDgEB/YimuTBAg4H4AAcgAM9DmCwMVeHMFfsYCNmPTHjPhyBA3AADsCBvXAAg43BxmDDgUNwYC+iSR4s4HAADsABONDjAAYbc3UIc8UONmLWEzPuwxE4AAfgABzYCwcw2BhsDDYcOAQH9iKa5MEC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AABEAABEAABEFiHAAZ7HV6UBgEQAAEQAAEQAAEQAIFZBP4fwLeJsp3pIUUAAAAASUVORK5CYII=

1、使用 resetField() 之前 el-form 一定要加 ref 属性
2、表单项 el-form-item 没有添加 prop 属性,同时 prop 属性值需与表单项的 v-model 保持一致
3、resetFields() 是将表单项重置为初始值,而这个初始值是在 Vue mounted 时赋值上去的,如果在这之前对表单进行了赋值,则初始值会改变(例如 created 时),那么后面调用 resetFields() 则不会生效(不会是定义时的空值)。
解决方法:将赋值操作定义在 this.$nextTick() 中(保证了初始值不被修改)

转自:https://blog.csdn.net/weixin_44002092/article/details/109896767



页: [1]
查看完整版本: Element-UI Form表单 resetFields() 重置表单无效问题